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:
`<?php $imgcount = 0; while (next_image()): $imgcount += 1; endwhile; print ($imgcount); ?>`
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`
Comments
`<?php echo getTotalImagesIn($_zp_current_album); ?>`
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 :-)