Ulti Clocks content

Show the number of views (page hits) in the camp26 latest news module

sand 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

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

Sam

18

Avr

  • 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


Add this page to your favorite Social Bookmarking websites
Digg! Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! Slashdot! Technorati! StumbleUpon! Spurl! Newsvine! Furl! Fark! Yahoo! Netvouz! Mister-Wong! RawSugar! Ma.gnolia! Squidoo! DZone! Swik!
LAST_UPDATED2
 

Add your comment

BoldItalicUnderlineStrikethroughSubscriptSuperscriptEmailImageHyperlinkOrdered listUnordered listQuoteCodeHyperlink to the Article by its id
Very HappySmileWinkSadSurprisedShockedConfusedCoolLaughingMadRazzEmbarrassedCrying or Very SadEvil or Very MadTwisted EvilRolling EyesExclamationQuestionIdeaArrowNeutralMr. GreenGeekUber Geek
Your name:
  The word for verification.
Lowercase letters only with no spaces.

The word for verification.<br/>Lowercase letters only with no spaces.
Word verification:

Titre:
Comment:



Show the number of views (page hits) in the camp26 latest news module



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