Member
Member
imagepet   2017-01-30, 21:38
#1

Hi everybody!

Is there a possibility to know, on which level of the album hierarchy an album resides (album, sub album, sub sub album, ...)? I would like something like getAlbumHierarchyLevel().
I didn't find anything in the forum nor in the documentation of the functions.
Many thanks.

Member
Member
sbillard   2017-01-31, 18:20
#2

count(explode('/', $albumobj->name));

Member
Member
imagepet   2017-01-31, 22:53
#3

Unfortunately, I always get 1 as result. What's wrong?
Hint: I'm using a customized zpmobile theme and the zenpage plugin.

Administrator
Administrator
fretzl   2017-02-01, 11:49
#4

Try this:
Put this function in your theme functions.php
function printAlbumHierarchyLevel() { global $_zp_current_album; $albumname = $_zp_current_album->name; $level = substr_count($albumname, '/') + 1; echo "Album level: " . $level; }
(This will give you Album level: 1 for a top-level album)

Then call `where you want it to appear inalbum.phpand/orimage.php`

Member
Member
imagepet   2017-02-01, 23:03
#5

Hi fretzl,

Works great, exactly what I was asking for. Thanks.

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