Wed 22 Apr |
|
The Latest News module (mod_latestnews) can be adapted to show the creation date of your latest articles. With a couple of small changes you can show the number of page views as well. Open file joomla_root/modules/mod_latestnews/helper.php in any text editor and go to line 113. Add these 2 lines after the $lists[$i]->text = htmlspecialchars( $row->title ); - $lists[$i]->hits = htmlspecialchars( $row->hits ); $lists[$i]->created = htmlspecialchars( $row->created ); so it looks like $lists[$i]->text = htmlspecialchars( $row->title ); $lists[$i]->hits = htmlspecialchars( $row->hits ); $lists[$i]->created = htmlspecialchars( $row->created ); $i++;Then open file joomla_root/modules/mod_latestnews/tmpl/default.php and go to line 7. Add the php echo statement - <?php echo "<div style='height:20px;'><span class='latestnews".$params->get('moduleclass_sfx')."'style='float:left;'> "; echo JHTML::_('date', $item->created,"$date_time_sys", $offset); echo "</span><span style='float:right;' class='sharedby".$params->get('moduleclass_sfx')."'>Views: ".$item->hits." </span> </div>";?> so it looks like - <?php // no direct access defined('_JEXEC') or die('Restricted access'); ?> <ul class="latestnews<?php echo $params->get('moduleclass_sfx'); ?>"> <?php foreach ($list as $item) : ?> <li class="latestnews<?php echo $params->get('moduleclass_sfx'); ?>"> <a href="<?php echo $item->link; ?>" class="latestnews<?php echo $params->get('moduleclass_sfx'); ?>"> <?php echo $item->text; ?></a> <?php echo "<div style='height:20px;'><span class='latestnews".$params->get('moduleclass_sfx')."'style='float:left;'> "; echo JHTML::_('date', $item->created,"$date_time_sys", $offset); echo "</span><span style='float:right;' class='sharedby".$params->get('moduleclass_sfx')."'>Views: ".$item->hits." </span> </div>";?> </li> <?php endforeach; ?> </ul>You now have this.... |
Last Updated on Wednesday, 22 April 2009 18:53 |