The simpler media website CMS
Hello,
I need to print the number of elements (sub albums + images) contained in the current album. I have found this function printAlbumData but I have no clue on the name of the available fields. Is there a way to do so?
Thanks
David
Comments
printAlbumData()
would not help you as it is for accessing database fields itself.For the direct child element count use these in the related theme context:
https://docs.zenphoto.org/function-getNumAlbums.html
https://docs.zenphoto.org/function-getNumImages.html
There are similar methodes on the core object model level as well.
Additionally there are for all imges on all sublevels (may be performance costly):
https://docs.zenphoto.org/function-getTotalImagesIn.html
There is no similar function for counting albums but you can use:
https://docs.zenphoto.org/function-getAllAlbums.html
and then count the results.
Additionally the image_album_statistics plugin provides a function to get the number of all sub albums on all levels for an albums.
https://docs.zenphoto.org/function-getNumAllSubalbums.html
Thank you, this is great.
Do you know how to get and print the current album ID then?
getAlbumID( ) is deprecated?
How to use getTotalImagesIn for direct child elements of the current album ? It requires Album object.
Thank you...
$_zp_current_album->getID()
if in album context.getAlbumID()
is actually not existing anymore. Don't remember when it was removed but there is the class method anyway.getTotalImagesIn()
(it's deprecated in the next version btw, since there will be an album class method for this) is not for the direct child images but for all, usegetNumImages()
for that.Thank you for your support Acrylian, this is perfect