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

How to display the number of article hits in the Blog layout - Joomla 1.5

GJC Web Design UK Joomla & VirtueMart how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help

A collection of help articles and coding examples for Joomla & Virtuemart

Belgium, VirtueMart & Joomla Web Design England UK Britain & Germany

Joomla, VirtueMart, how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help sand Display the number of page views (hits) for each article within the Joomla Blog content layout.
php, item, date, hits, modified, joomla, pre, jtext, endif, number, class, echo, content, params, times, xml, html, updated, jhtml, format, looks, display, article, com, div, read, blog, span, sprintf, colspan, intval, modifydate, modify, float, right, accessed, displayed, style, moved, add

Home Joomla - VirtueMart Joomla & VM How To's How to display the number of article hits in the Blog layout - Joomla 1.5

Tue

14

Apr

How to display the number of article hits in the Blog layout - Joomla 1.5
  • Joomla 1.5
  • com_content

This change will display the number of times each article has been read (hits) in the Joomla 1.5 Content Blog layout.

You can see how it looks on this page.


Open file joomla_root/components/com_content/views/category/tmpl/blog_item.php in any text editor and go to line 124.
The table cell were interested in looks like this -
 
<?php if ( intval($this->item->modified)\n != 0 && $this->item->params->get('show_modify_date')) : ?>
<tr>
  <td colspan="2"  class="modifydate">
    <?php echo JText::sprintf('LAST_UPDATED2', JHTML::_('date', $this->item->modified, JText::_('DATE_FORMAT_LC2'))); ?>
 
  </td>
</tr>
<?php endif; ?>
 
You need to add the conditional clause to display the number of hits for each item.
The <?php endif; ?> have been moved as well -
 
<?php if ( intval($this->item->modified) != 0 && $this->item->params->get('show_modify_date')) : ?>
<tr>
  <td colspan="2"  class="modifydate">
    <?php echo JText::sprintf('LAST_UPDATED2', JHTML::_('date', $this->item->modified, JText::_('DATE_FORMAT_LC2'))); ?>
        <?php endif; ?>
        <?php if ($this->params->get('show_hits')) : ?>
   <span style="float:right;">
                  Read : <?php echo $this->item->hits; ?> times
   </span>
  </td>
</tr>
 
Now the number of times the article has been accessed (hits) is displayed.


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 Updated on Thursday, 16 April 2009 21:55
 

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:

Subject:
Comment:
Comments (1)
Thanks
1 Sunday, 14 June 2009 09:22
Thanks for this
Thanks for the instructions !Mr. Green

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

GJC Web Design UK Joomla & VirtueMart how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help

A collection of help articles and coding examples for Joomla & Virtuemart

Belgium, VirtueMart & Joomla Web Design England UK Britain & Germany

Joomla, VirtueMart, how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help



How to display the number of article hits in the Blog layout - Joomla 1.5



Display the number of page views (hits) for each article within the Joomla Blog content layout.


php, item, date, hits, modified, joomla, pre, jtext, endif, number, class, echo, content, params, times, xml, html, updated, jhtml, format, looks, display, article, com, div, read, blog, span, sprintf, colspan, intval, modifydate, modify, float, right, accessed, displayed, style, moved, add