First, let me say I am very impressed with ZenPhoto!
My galler is up, but I'm having a real hard time trying to get the hit counters to work. My questions...
1) What file(s) do I need to add the hitcounter function to?
2) What should the function look like?
string hitcounter( [string $option = 'image'], [bool $viewonly = false], [int $id = NULL] )
3) Where in the file should I add the function?
any other advice on how to get this function enabled while using the default template is much appreciated.
Comments
Usage is simple `<?php hitcounter("image",true)`for a hitcounter on image.php that shows the actual hitcount. And please read this, too: http://www.zenphoto.org/2008/04/how-to-read-the-zenphoto-functions-guide/
Also, I noticed you used true in your hitcount fuction. According to to the parameters in template-functions.php, if set to true: "...you don't want to increment the counter." [http://www.zenphoto.org/documentation/zenphoto/_template-functions.php.html#functionhitcounter]
I'd like to be able to see which pictures are getting more clicks, so I DO want to increment the counter. I placed the following in my image.php file:
<?php hitcounter("image",false) ?>
But I don't know how to either 'print the actual hit count near the image' or 'find out which images are getting the most traffic'. Is there a section in the admin area that shows hit counts or can someone give me some advice on printing hit count?
thanks
UPDATE: I noticed that hit counts are recorded on 'Edit' tab for galleries, and hits are now being recorded. However, this method of checking hits is a bit troublesome. Maybe there is a plugin or hack that provided administrators with... Top 5, 10, 20, 50 rated images; albums with most hits, images with most hits, etc.
To print the hitcount simple echo it: `<?php echo hitcounter("image",false) ?>.
We don't have any admin functionality for that, since all functions are optional. But we have several functions for themes:
http://www.zenphoto.org/documentation-official/zenphoto/_template-functions.php.html#functionprintPopularImages
http://www.zenphoto.org/documentation-official/zenphoto/_template-functions.php.html#functionprintPopularAlbums
And for the image rating, too:
http://www.zenphoto.org/documentation-official/zenphoto/_template-functions.php.html#functionprintMostRatedImages
http://www.zenphoto.org/documentation-official/zenphoto/_template-functions.php.html#functionprintMostRatedAlbums
http://www.zenphoto.org/documentation-official/zenphoto/_template-functions.php.html#functionprintTopRatedAlbums
http://www.zenphoto.org/documentation-official/zenphoto/_template-functions.php.html#functionprintTopRatedImages
Thanks for your support. I've got the hitcounter working as I'd like on the default theme's image.php file and here's what I did...
Replaced:
<?php if (getOption('Allow_ratings')) { printImageRating(); }?>
With:
<table border="0" width='100%'>
<tr><td><?php if (getOption('Allow_ratings')) { printImageRating(); }?></td>
<td valign='center' align='right'>Image Views: <?php echo hitcounter("image",false) ?></td></tr>
</table>
Now the hits display beneath the image. Thanks again!
when i did what "bones" did by :
Replaced:
<?php if (getOption('Allow_ratings')) { printImageRating(); }?>
With:
<table border="0" width='100%'>
<tr><td><?php if (getOption('Allow_ratings')) { printImageRating(); }?></td>
<td valign='center' align='right'>Image Views: <?php echo hitcounter("image",false) ?></td></tr>
</table>
in the album file in nighty build i got this message:
Zenphoto Error
MySQL Query ( SELECT total_value FROM `zp_images` WHERE id = ) Failed. Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
hi developers
it is ok i got it right