ZenphotoCMS Forum
Parent album folder name - 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: Parent album folder name (/thread-2662.html)



Parent album folder name - carasmo - 2008-04-13

Hello,

I have this set up where there are parent albums, like Golf and Recreational Centers, and then there's sub albums inside that of different projects under that parent album.

On the image.php I've added a list of all the main albums, not the sub albums, and what I'd like is to create a body class based on the parent albums folder name so that I can style the links to the different albums and indicate the current parent album.

I've looked high and low and can't find something.

This outputs in the complete parent and subfolder, but I just want the parent folder name:``

Thanks!!!




Parent album folder name - acrylian - 2008-04-13

You could extract that from the folder of your current album. The folder names follow this parentfolder/subfolder/.... Try using explode() (see a PHP manual for details) to extract the parent folder. I did it partly that way in print_album_menu.php for the subalbums, you might take a look at the code there, too.




Parent album folder name - carasmo - 2008-04-13

Thanks for the quick response. I don't know anything about php, just an artist here. I was hoping for something like (which doesn't work of course):

``

or ``

No big deal. Would be cool though.




Parent album folder name - trisweb - 2008-04-13

The Album class has a getParent method just for that.

When in doubt, check the docs http://www.zenphoto.org/documentation/zenphoto/Album.html#methodgetParent

``




Parent album folder name - carasmo - 2008-04-13

I pasted this into my image.php and it doesn't return an error, but it also doesn't print or show anything at all:

``

Nice to see you again! I hope you are doing well.




Parent album folder name - sbillard - 2008-04-14

Well, you sort of have to make it print something. You could add echo $folder; if you want it to show up.




Parent album folder name - carasmo - 2008-04-14

THANKS!

That rocks!