Member
Member
Idrownpuppies   2008-08-22, 12:48
#1
Hi,

I want to see on my index.php the total images views per album including subalbums. I've done it at the moment this way:

in my image.php I have:

<?php echo hitcounter('image', false); ?>
<?php hitcounter('album', false); ?>

So everytime the image is viewed it adds 1 to the image hitcounter and 1 to the albums hitcounter.

Therefore with <?php echo hitcounter('album',true,getAlbumID()); ?> on index.php I get the total views of that album.

The only problem with this workaround is, it doesn't work anymore if I work with subalbums. Is there a code that gives the total image views per album including subalbums?

Like <?php echo getTotalImagesIn($_zp_current_album);?> does it for the total number of images.

I hope you understand my problem (well its not huge a problem though, I still enjoy my zenphoto very much),

cheers,
Jeroen
Member
Member
sterk   2008-08-29, 12:58
#2
a feature i would like to see
Member
Member
sbillard   2008-08-29, 14:05
#3
Certainly something you could add if you want.
Member
Member
sterk   2008-08-31, 12:05
#4
and how can it be done? or is it already in zenphoto?
Administrator
Administrator
acrylian   2008-08-31, 12:35
#5
No, it isn't you would have to write a function yourself.
Member
Member
sterk   2008-08-31, 16:48
#6
time for me to learn some php

or i can use Idrownpuppies way. only its not working for subalbums
Administrator
Administrator
acrylian   2008-08-31, 17:01
#7
you can pass a the id of an album or image directly to the hitcounter() function to get it for a specific album/image. If you know the ids of them all you can summarize them. There is of course a way to do that more convenient via the classes. Another way would be to use a db query to get them. But I currently don't have the time to try that.
Member
Member
wittie   2013-10-05, 03:08
#8
To display the total number of views of all images in the gallery

<?php
$sum = mysql_query("SELECT SUM(hitcounter) FROM zp_images");
$views = mysql_fetch_array($sum);
$total = $views[0];
echo $total;
?>
Administrator
Administrator
acrylian   2013-10-05, 09:17
#9
Or use the object model so unpublished and protected items and those from protected and unpublished albums are not counted.
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.