ZenphotoCMS Forum
getHitCounter() - 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: getHitCounter() (/thread-4406.html)



getHitCounter() - edasque - 2009-01-05

Hi,

how would one use getHitCounter() to print the counts for each album in index.php ? At this point, I am in an album loop, I think. I used to call hitcounter(getAlbumID()) or something similar.

Erik




getHitCounter() - sbillard - 2009-01-06

$h = getHitcounter($_zp_current_album);




getHitCounter() - edasque - 2009-01-06

Hmm, that doesn't seem to work on the Default theme, line 33, as such:
`

...

Views: 

...

`




getHitCounter() - sbillard - 2009-01-06

That might just be because your statement creates no output. Nor does it match what I showed you. You need to print the value of the hitcounter if you want it to show up.




getHitCounter() - edasque - 2009-01-06

ok, sorry, you're right, typo. What about:

...

Views:

...

because it doesn't work either.




getHitCounter() - acrylian - 2009-01-06

This is probably because there is no hitcount taken. With 1.2.2 the hitcounting is enabled always by default but is only taken for not logged in users.




getHitCounter() - edasque - 2009-01-06

This is a site that's been going on for a long while. There is a hit count on those albums when I use the deprecated function.




getHitCounter() - edasque - 2009-01-07

Yes, checked again, those hitcounts are not 0:

SELECT folder,hitcounter FROM albums where isnull(parentid)

`

folder hitcounter

Portfolio 2003 911

Portfolio 2002 1103

Portfolio 2005 967

Portfolio 2001 500

Miscellaneous 405

Portfolio 2006 1562

Sports 504

Underwater 602

Themed 613

Others 900

Portfolio 2007 1683

Techniques 457

Portfolio 2008 2196

`




getHitCounter() - sbillard - 2009-01-08

Have you run the Effervescence+ theme on your site? It displays hits on albums and seems to be working correctly at least on my site.




getHitCounter() - edasque - 2009-01-08

Hmmm, no it doesn't display hits on the albums in index.php. What I want is to display the hits for each album in the loop of index.php, like so:

http://www.frenchguys.com/gallery/

Where it says:
Quote:Viewed:: times




getHitCounter() - sbillard - 2009-01-09

Do the hits show up on the albums page?

The function behaves as follows:

if you pass an album parameter it will return the hitcounter for that album.
If you do not pass an album parameter it will determine if you are on an image, album, or other page and return the image hitcount, the album hitcount, or NULL.

Perhaps the parameter you passed is NULL.




getHitCounter() - edasque - 2009-01-09

Ok, that makes sense. Would I use something similar to `in a
loop ? How does one get the current album ?




getHitCounter() - acrylian - 2009-01-09

I just took a quick look at the function and it actually does not allow to display the hitcounter within the next_album loop. It checks currently automatically for the gallery page to be either "album.php" or "image.php" and if not always return NULL.
We will need to change the function so that it behaves like the old one again.




getHitCounter() - edasque - 2009-01-09

Ah good, I thought I was going crazy or was really incompetent. Turns out that it's that and I might have encountered a problem (I didn't cause). I am glad. Thanks for helping out guys. You're doing a great job with ZP. Can't say enough good things about it and your support.




getHitCounter() - acrylian - 2009-01-09

Should be fixed in the svn now. Btw, you can also use echo $_zp_current_album->get("hitcounter")to get the hitcount within the next_album loop.