Show the number of views (page hits) in the camp26 latest news module - Joomla & VirtueMart Tips & How To's

How to show the number of views (page hits) in the camp26 latest news module.

Home Joomla VirtueMart Tips Show the number of views (page hits) in the camp26 latest news module

Sat

18

Apr

Show the number of views (page hits) in the camp26 latest news module
  • Joomla 1.5
  • Module mod_camp26_latestnews

The Camp26 Latest News module provides a nice sidebar listing of your latest articles.

With a couple of small changes you can show the number of page views as well.

Camp26 Latest News module Open file joomla_root/modules/mod_camp26_latestnews/helper.php in any text editor and go to line 131.
Add this line there after the $lists[$i]->name = htmlspecialchars( $row->name ); -
 
$lists[$i]->hits = htmlspecialchars( $row->hits );
 
Then open file joomla_root/modules/mod_camp26_latestnews/tmpl/default.php and go to line 44, although this depends on which $intregated_sys and $time_sys parameter you've selected.
If you've chosen another parameter then scroll down until you've found the appropriate one.
Change the php echo statement from -
 
<?php echo "<span class=\"sharedby\"> $shared_by $item->name ";
  echo JHTML::_('date', $item->created,"$date_time_sys", $offset); 
  echo "</span>";?>
 
To this to display the views at the right hand side -
 
<?php echo "<div style='height:20px;'><span class='sharedby'style='float:left;'> $shared_by  ";
    echo JHTML::_('date', $item->created,"$date_time_sys", $offset); 
    echo "</span><span style='float:right;' class='sharedby'>Views: ".$item->hits."
                      </span>
            </div>";?>
 
You now have this.... Camp26 Latest News module views
Last Updated on Wednesday, 22 April 2009 12:28
 
VirtueMart
Your Cart is currently empty.

Latest Joomla & VirtueMart Tips

See all tips & examples



Show the number of views (page hits) in the camp26 latest news module|Joomla & VirtueMart Tips & How To's



How to show the number of views (page hits) in the camp26 latest news module.


camp, echo, joomla, latest, span, views, pre, module, php, style, news, class, div, date, sys, right, item, float, time, sharedby, hits, html, xml, line, height, latestnews, mod, offset, created, parameter, root, lists, modules, row, shared, jhtml, margin, open, htmlspecialchars, file


guru

We use cookies to improve our website and your experience when using it. Cookies used for the essential operation of the site have already been set.
To find out more about the cookies we use and how to delete them, see our privacy policy.

I accept cookies from this site.