Print link to album (not sub-album)?

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: "<?php echo getAlbumLinkURL();?>"

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 "<?php printParentBreadcrumb(); ?>", 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.

Comments

  • acrylian Administrator, Developer
    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.
  • Rain Member
    That might as well be in Latin. That's over my head.

    No easy way to magically do a "printAlbumLinkDammit", or something? :)
  • acrylian Administrator, Developer
    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.
  • Rain Member
    Awesome. Thank you!

    In case someone else is looking for this:

    `getParent(); echo $parentlink = $parent->getAlbumLink();?>">Link text`
  • Rain Member
    Just had a facepalm moment; this simple method also works in this case:

    `Link text`
  • acrylian Administrator, Developer
    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.
  • Rain Member
    Yeah, works with pretty URLs only, should have mentioned that.
Sign In or Register to comment.