Member
Member
davidarnoult   11-03-2019, 22:53
#1

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

Administrator
Administrator
acrylian   12-03-2019, 10:18
#2

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

Member
Member
davidarnoult   12-03-2019, 13:18
#3

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...

Administrator
Administrator
acrylian   12-03-2019, 13:47
#4

Do you know how to get and print the current album ID then getAlbumID( ) is deprecated?

$_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, use getNumImages() for that.

Member
Member
davidarnoult   30-03-2019, 20:27
#5

Thank you for your support Acrylian, this is perfect :smile:

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.