Member
Member
Rain   2011-03-30, 16:12
#1

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.

Administrator
Administrator
acrylian   2011-03-30, 16:40
#2

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.

Member
Member
Rain   2011-03-30, 16:57
#3

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

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

Administrator
Administrator
acrylian   2011-03-30, 17:23
#4

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.

Member
Member
Rain   2011-03-30, 18:00
#5

Awesome. Thank you!

In case someone else is looking for this:

Link text

Member
Member
Rain   2011-03-30, 19:54
#6

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

Link text

Administrator
Administrator
acrylian   2011-03-31, 08:27
#7

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.

Member
Member
Rain   2011-03-31, 10:11
#8

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

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