web design, England, Britain, UK, belgium
 
Ulti Clocks content

How to display the number of article hits & creation date in the Latest News Module - Joomla 1.5

JOOMLABOTTOM sand How to display the number of article hits & creation date in the Latest News Module - Joomla 1.5
php, echo, latestnews, style, latest, span, class, hits, sfx, item, params, moduleclass, htmlspecialchars, created, lists, module, joomla, div, row, float, views, date, news, pre, height, title, text, right, mod, left, jhtml, line, sys, time, sharedby, add, access, html, like, xml

Home Joomla - VirtueMart Joomla & VM How To's How to display the number of article hits & creation date in the Latest News Module - Joomla 1.5

woe

22

apr

How to display the number of article hits & creation date in the Latest News Module - Joomla 1.5
  • Joomla 1.5
  • Module mod_latestnews

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.

Latest News module 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.... 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!
Laatste aanpassing op woensdag 22 april 2009 18:53
 

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:

Titel:
Comment:
Comments (2)
@Kevin
2 zaterdag 16 mei 2009 06:20
GJC (admin)
Thanks, please social bookmark the article to "share" the knowledge....
Cool!
1 zaterdag 16 mei 2009 05:14
Kevin
This is great! I just need it. Thanks!

Our Recommended Reading

For those interested in extending their knowledge of Joomla! & VirtueMart, Packt Publishing has an excellent range of help & how to books.
Listed below are some I can recommend.
Simply click on the images to be taken directly to their web shop.


Joomla! Social Networking with JomSocial
Joomla! Social Networking
with JomSocial

by Kwasi Boateng & Beatrice A. Boateng.
Joomla! 1.5 Multimedia
Joomla! 1.5 Multimedia
by Allan Walker.


Building job sites with Joomla!
Building job sites with Joomla!
by Santonu Kumar Dhar.

Joomla! Template Design: Create your own professional-quality templates with this fast, friendly guide
Joomla! Template Design: 2nd Edition
Create your own professional-quality
templates with this fast, friendly guide
by Tessa Blakeley Silver.
Magento: Beginner's Guide
Magento: Beginner's Guide by William Rice
is a must for anyone trying the
open-source e-Commerce solution.

Read the review

object-oriented-javascript-applications-libraries
Object-Oriented JavaScript by
Stoyan Stefanov gives you a very
comprehensive grounding in
the latest Javascript techniques.

Read the review
Joomla! Web Security
Joomla! Web Security
by Tom Canavan.

Joomla 1.5 Top Extensions Cookbook
Joomla 1.5 Top Extensions Cookbook by
Suhreed Sarkar is an ideal and concise round up of the extensions available for the Joomla! system.

Read the review

Latest Articles

Paypal Donation

If you use this module on your site please donate a small amount.
Any donation amount appreciated.

VM Live Product Search

Recommended Reading

For those interested in extending there knowledge of Joomla! & VirtueMart Packt Publishing has an excellent range of help & how to books.
Listed below are some I can recommend.
Simply click on the images to be taken directly to their web shop.

Mastering Joomla! 1.5 Extension and Framework Development
Mastering Joomla! 1.5 Extension and
Framework Development : 2nd Edition

by James Kennard.
Read the review

Building job sites with Joomla!
Building job sites with Joomla!
by Santonu Kumar Dhar.
Learning Joomla! 1.5 Extension Development Learning Joomla! 1.5 Extension Development
by Joseph L. LeBlanc.
Read the review
Joomla! E-Commerce with VirtueMart
Joomla! E-Commerce with VirtueMart
by Suhreed Sarkar.

Read the review
Joomla! 1.5 Site Blueprints Joomla! 1.5 Site Blueprints
by Timi Ogunjobi.

Joomla! 1.5 JavaScript jQuery Joomla! 1.5 JavaScript jQuery
by Jose Argudo Blanco.
Read the review
Joomla! Social Networking with JomSocial Joomla! Social Networking with JomSocial
by Kwasi Boateng & Beatrice A. Boateng.

Joomla! 1.5 Multimedia Joomla! 1.5 Multimedia
by Allan Walker.

Joomla! Web Security Joomla! Web Security
by Tom Canavan.

Mastering Joomla! 1.5 Extension and Framework Development Mastering Joomla! 1.5 Extension and Framework Development : 2nd Edition
by James Kennard.

Joomla! Template Design: Create your own professional-quality templates with this fast, friendly guide Joomla! Template Design: Edition 2 - Create your own professional-quality templates with this fast, friendly guide
by Tessa Blakeley Silver.

Magento: Beginner's Guide
Magento: Beginner's Guide by William Rice
is a must for anyone trying the
open-source e-Commerce solution.

Read the review

JOOMLABOTTOM



How to display the number of article hits & creation date in the Latest News Module - Joomla 1.5



How to display the number of article hits & creation date in the Latest News Module - Joomla 1.5


php, echo, latestnews, style, latest, span, class, hits, sfx, item, params, moduleclass, htmlspecialchars, created, lists, module, joomla, div, row, float, views, date, news, pre, height, title, text, right, mod, left, jhtml, line, sys, time, sharedby, add, access, html, like, xml