Show Hits At Frontpage & Category Pages

Note: Until second version of Module Hits AnyWhere is ready, I ask you to use the following guide to show hits at Category as well as Front Pages. As Hits AnyWhere Module shows hits at individual pages only to make your sit show hits at main website page and other pages following guide will help you:

Show Hits at Category Pages with Each Item:

You want to show the hits for every article in category page too?


You need to add the following code in your category page:

<@?php echo "Total Hits: ".$this->item->hits; ?>
(Remove @ from the start of this code.)
You can change the "Total Hits: " with anything you want...

Ideally your joomla template should have html override folder...
i.e. you need to open this blog_item.php file, and add the above
code where you want to display the hits.

your joomla template > html > com_content > category > blog_item.php

This will work perfectly for you I am sure as we do this daily :-)
If you do not know how to edit template or your current tempalte dont
have the html override folder, let us know, and one of our coder will do
implement this for you.

Show Hits at Frontpage (Main page) of Your Joomla Site:

Just add the above code in the frontpage item i.e.

<@?php echo "Total Hits: ".$this->item->hits; ?>

(Remove @ from the start of this code.)
into the following file:
joomla template > html > com_content > frontpage > default_item.php

(Add this in the above file at the position where you want to show the hits)

But to make this code work you need to add one more little code at joomla page i.e.

Open components/com_content/models/frontpage.php
Search for this line at about 128th line:

$query = ' SELECT a.id, a.title, a.title_alias, a.introtext, a.fulltext......... big line :-)

you need to add this code (a.hits,) at the end before the "'"
i.e.
a.attribs, a.urls, a.metakey, a.metadesc, a.access,

becomes :
a.attribs, a.urls, a.metakey, a.metadesc, a.access, a.hits,

This will make the code in template (you add at above heading) to work fine.

Refresh your site and see the hit counts it would work fine now.

Regards,

Mohsin Rasool

PS. If you want any customization, or this does not work in your situation. You can submit a support ticket at our desk and let one of our expert coder do this for you. Good Luck

 

 

From Our Blog

  • Redirect to Different Page for Different Refferer Sites
    Hi, A friend asked this: if there’s a simple way to redirect certain users to a different page with some javascript or php or something else easy to implement.What I’d like to do is the following: Let’s say my site is mysite.com. If the user comes to mysite.com from MyFriendsSite.com, I’d like to redirect him [...]
  • WordPress SEO – Top 3 Must Things To Do Today
    WordPress is already awesome when it comes to SEO, even Matt Cuts of Google admit this at his official blog. You have already taken right step of choosing WordPress as your blog or site back-end. However there are few critical SEO steps you must take to really make it command the best possible ranking in [...]
  • Windows 7 Multiple Network Internet Problem
    We experienced this crazy problem here at Window7 Powered machine, every time our computer will start, it will recognize Two Networks, one Public Network and other Unidentified Network. And there would be no Internet Access until I Disable the Network Adaptor, and Re-enable it. Just today I found the solution to this problem which I [...]

Do you want more traffic for your websites and blogs? Subscribe to Fit Tips Newsletter and Also checkout Free Instant Traffic (FiT) Reports