phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


Joomla - Module: Showing Few Text After Link (Part 4)

Tag: joomla, cms   Category: PHP Framework
post: 20 Nov 2007 read: 1,858


In the last tutorial, we showed link at front page. Now, we will add message text than only display link. It will help our reader to review before they decide to click that link. We do with simple way.

Open and edit "mod_hello.php":


<?php
defined('_JEXEC') or die('Restricted access');

$items = $params->get('items', 1);
$db =& JFactory::getDBO();
$query = "SELECT id, message 
                     FROM #__hello 
           		  WHERE published = '1' 
           		  ORDER BY id DESC";
$db->setQuery( $query, 0 , $items );
$rows = $db->loadObjectList();
foreach($rows as $row)
{
   	echo 'ID: <A href="'. JRoute::_
              ('index.php?option=com_hello&id='.$row->id.'&task=view') .'">'.$row->id.'</A> </br>';
  	echo $row->message .'</br>';
}
?>

We can use like substr() to limit characters.

It is simple way. But we have other choice than this way. The way that more efficient to handle different scenario. We will discuss next posting. Don't miss it!



Series this article:
Joomla - Module: Register Database (Part 1)
Joomla - Module: Showing Module at Front End (Part 2)
Joomla - Module: Show Items from database (Part 3)
Joomla - Module: Showing Few Text After Link (Part 4)
Joomla - Module: Using Helper (Part 5)
Joomla - Module: Using Template for Layout Flexibility (Part 6)
Joomla - Module: Trying Alternative Layout (Part 7)
Joomla - Component: Showing Number of Comment at Last Post (Part 8)

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting