ZenphotoCMS Forum
Get total image count in current album - 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: Get total image count in current album (/thread-11754.html)



Get total image count in current album - LondonLight.org - 16-04-2014

Hey!

I display all images in an album in their default size on one page using a next_image loop, and I would like to also get a count of the total number of images. I'm a beginner with PHP and this is what I came up with:
``
It works, but do I really need to iterate over the loop to get it?

I saw a function getTotalImagesIn exists, but can't figure out how to use it. I tried print (getTotalImagesIn( getAlbumTitle( ))); but that fails with Fatal error: Call to a member function getNumImages() on a non-object in /var/www/localhost/htdocs/zp/zp-core/template-functions.php on line 1985




Get total image count in current album - fretzl - 16-04-2014

Use something like this:
``




Get total image count in current album - acrylian - 16-04-2014

print (getTotalImagesIn( getAlbumTitle( )))
You really should look at the documentation before trying random things… That function requires an album object.
http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functiongetTotalImagesIn
That album object is available in the global $_zp_current_album if you are in album context. http://www.zenphoto.org/news/zenphotos-object-model-framework

Edit: Ah, Fretzl was faster and shorter :-)




Get total image count in current album - LondonLight.org - 17-04-2014

Thank you.