ZenphotoCMS Forum
How to check album level - 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: How to check album level (/thread-9113.html)



How to check album level - billkerr - 2011-09-27

Hi,

I would like to use PHP if else statements to show different elements on my page depending on the location within the album/subalbum structure.

My albums:

[list]
[*]Parent album

Sub-album

Album 1
[*]Album 2
[/list]

How can I check if I am in a parent album, a sub-album, or the album itself?

Thanks.




How to check album level - sbillard - 2011-09-27

there is an object method for the parent: $obj->getParent(). This will return NULL for albums which are the parent.




How to check album level - acrylian - 2011-09-28

And using the template function getParentAlbums() you can even count the array returned (null as well if there are no parents) to find out on what level you are.