Hi all,
when is images.hitcounter incremented ? All entries in my images table have a NULL value for that column. Am I not doing something I should be doing in my theme ? Or is it something that's not yet used in the release (but might be in trunk ?).
Comments
5
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/gm/gallery/zp-core/functions-db.php on line 85
The proper use of this function is to place it in the theme when you want hitcounts. It is not there by default because it adds overhead. At present you have to put a call to hitcounter in your album.php and image.php files if you want hitcounts.
The useage of hitcounter is:
`hitcounter("image");` for image.php and `hitcounter("album");` for album.php. If you wish to show the hitcounter then use `echo hitcounter($option");`
There is an api that both increments and returns the hitcounter. None that just retrieves it. The function is `hitcounter($what)` where `$what` is `image` or `alubm`. Increments and returns the hitcounter for the currene image or ablum.
Your theme needs to include this function if you want a page to be counted.
The image & album classes could use a getter for hitcounter
printPopularAlbums($number)
printPopularImages($number)
Yes, I know of those, but I want to build a slightly different version that outputs the hitnumber for each of those images/albums. Don't you think hitcounter should have a neutral getter that doesn't also increment it, something in the image and album classes ?
Its not that big problem to modify the getImage/AlbumStatisitc functions to put out the hitcounter when printing the popular images/albums, since we already do a query we could easily expand that.
One additional example, not increment the hitcounter if the admin is looking at the image:
if admin then echo getHitCounter else hitcounter(image) endif