Support Forums

Total hits counter

This is a discussion on Total hits counter within the Modules / Plugins / Modifications forums, part of the Developer Forums 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 > Developer Forums > Modules / Plugins / Modifications

Reply
 
Thread Tools Display Modes
Old 09-17-2008, 05:08 AM   #1
Senior Member
 
 
Join Date: Apr 2008
Posts: 144
Rep Power: 15
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
philoo is offline   Reply With Quote
Old 09-29-2008, 09:07 AM   #2
Genius At Work
 
bowers01's Avatar
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 1,086
Rep Power: 34
bowers01 is on a distinguished road
Default

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

Thanks for sharing it with us!
cathouse911 is offline   Reply With Quote
Reply

Tags
forever philoo , thank you philoo

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
category total on left menu centinel3 Modules / Plugins / Modifications 10 11-10-2009 01:03 PM
Total ads counter philoo Technical Support 6 09-17-2008 05:06 PM


All times are GMT -4. The time now is 07:56 AM.


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