Member
Member
carasmo   2008-04-13, 16:48
#1

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

Administrator
Administrator
acrylian   2008-04-13, 17:19
#2

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.

Member
Member
carasmo   2008-04-13, 19:44
#3

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.

Developer
Developer
trisweb   2008-04-13, 22:08
#4

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

``

Member
Member
carasmo   2008-04-13, 22:42
#5

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.

Member
Member
sbillard   2008-04-14, 00:49
#6

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

Member
Member
carasmo   2008-04-14, 03:06
#7

THANKS!

That rocks!

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