ZenphotoCMS Forum
Print link to album (not sub-album)? - 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: Print link to album (not sub-album)? (/thread-8432.html)



Print link to album (not sub-album)? - Rain - 2011-03-30

Hi, I'm having a hard time figuring out how to link to an album's main page. Let me explain.

My structure is: "Gallery > Album X > Sub-album X"

When viewing an image in the sub-album, I can easily link to "Sub-album X" by using: ""

What I need is to be able to link to "Album X" while being able to control what the link says. I am aware that it's possible to link to "Album X" using "", but that prints the album's name as the link.

Been searching like a mad man, any help?

Cheers!

*Edit: Just noticed I posted in the wrong forum. Soz about that.




Print link to album (not sub-album)? - acrylian - 2011-03-30

You get the parent album object by using $_zp_current_album->getParent() (if in an album and one exists). See the object model tutorial and the functions documentation on our user guide.




Print link to album (not sub-album)? - Rain - 2011-03-30

That might as well be in Latin. That's over my head.

No easy way to magically do a "printAlbumLinkDammit", or something?




Print link to album (not sub-album)? - acrylian - 2011-03-30

Yes, but not for the parent album which you have to get first.
It is not really hard:
$parent = $_zp_current_album->getParent() $parentlink = $parent->getAlbumLink();
Now build your link with that.




Print link to album (not sub-album)? - Rain - 2011-03-30

Awesome. Thank you!

In case someone else is looking for this:

Link text




Print link to album (not sub-album)? - Rain - 2011-03-30

Just had a facepalm moment; this simple method also works in this case:

Link text




Print link to album (not sub-album)? - acrylian - 2011-03-31

Only if you have modrewrite enabled as the url is not a real folder path and probably not from an image page. The way above is the way to do it.




Print link to album (not sub-album)? - Rain - 2011-03-31

Yeah, works with pretty URLs only, should have mentioned that.