ZenphotoCMS Forum
Hit Counter Help - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Hit Counter Help (/thread-2800.html)



Hit Counter Help - bonez - 2008-05-03

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.




Hit Counter Help - acrylian - 2008-05-04

Since that function is able to count either album or image hit, you can add it to album.php or image.php. If you want the counter to be shown, you need to place that function where you want it to appear.
Usage is simple `




Hit Counter Help - bonez - 2008-05-04

Just so I understand; hit counts will not start until this fundtion is added to either images.php or album.php in the appropriate theme folder.

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:

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.




Hit Counter Help - acrylian - 2008-05-04

Right my usage of "true" was indeed wrong, but that's what our functions guide is for.
To print the hitcount simple echo it: `.

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




Hit Counter Help - bonez - 2008-05-04

Hey Acrylian,
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:

With:

Image Views: 

Now the hits display beneath the image. Thanks again!




Hit Counter Help - bill61 - 2008-05-04

hi developers

when i did what "bones" did by :

Replaced:

With:

Image Views:

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




Hit Counter Help - bill61 - 2008-05-04

hi developers

hi developers

it is ok i got it right