68 Classifieds Forums

Total hits counter

This is a discussion on Total hits counter within the v4 Modules / Modifications forums, part of the Help & Support category; As I wanted to offer my customers a message on the home page like This website offers {total_ads} that have ...


Go Back   68 Classifieds Forums > Help & Support > v4 Modules / Modifications

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 09-17-2008, 06:08 AM
philoo's Avatar
Senior Member
 
Join Date: Apr 2008
Posts: 130
Rep Power: 6
philoo is on a distinguished road
Default Total hits counter

As I wanted to offer my customers a message on the home page like

This website offers {total_ads} that have been viewed {total_hits} times

... I had to create a new Smarty Plugin to make the {total_hits} variable available (the {total_ads} is natively offered in 68C). This function is the sum of the number of visualisation of each ad (hitcount in database).

Basically this new function is a hack of the function.total_ads.php that allready exists in /includes/classes/smarty/plugin

The new function is named function.total_hits.php and also placed in /includes/classes/smarty/plugin

here is the code of function.total_hits.php you must create :

PHP Code:
function smarty_function_total_hits($params, &$smarty)
{
    global 
$db;
    
    
//get total active listings
    
$sSQL="SELECT SUM( hitcount ) as total FROM ".PREFIX."listings";
    
$result=$db->query($sSQL);
    
$rs=$result->fetch();
    
$total_hits=$rs['total'];

    return 
$total_hits;
}
?> 

Enjoy the new {total_hits} variable in your templates

__________________
v4.08 Developer
Reply With Quote
  #2  
Old 09-29-2008, 10:07 AM
bowers01's Avatar
Senior Member
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 582
Rep Power: 14
bowers01 is on a distinguished road
Default

Hi,
{total_ads} does not work. It is actually {total_listings}
Nick
__________________
Nick Bowers
68c v4.09 Developer
Reply With Quote
  #3  
Old 11-22-2008, 01:55 PM
Member
 
Join Date: May 2008
Posts: 69
Rep Power: 4
cathouse911 is on a distinguished road
Default This was nice

Thanks for sharing it with us!
Reply With Quote
Reply

Bookmarks

Tags
forever philoo, thank you philoo

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Total ads counter philoo v4 Questions & Support 6 09-17-2008 06:06 PM
category total on left menu centinel3 v4 Modules / Modifications 7 08-26-2008 11:26 AM
How to display category total listings? dankellaway v3.1 Questions & Support 2 03-13-2007 02:25 PM
Display Total Number of Users Eric Barnes v3.0 Questions & Support 5 05-10-2006 12:22 PM
Display Total Number of Listings Eric Barnes v3.0 Questions & Support 2 03-30-2006 03:29 PM


All times are GMT -4. The time now is 08:41 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22