Print Parent Page Title?

Is there a way to print the pages parent title?

As in if the page is a sub page of another page how do I get it to print the parent title?

Cheers

GW

Comments

  • You could probably do something with using the getPageParentID() function and setting of objects to extract title of the parent.

    Edit:
    Actually, completely forgot about this function:

    printParentPagesBreadcrumb()

    That does what you need.
  • Resolved, well sort of... I have used the Custom Data field :)

    Cheers

    GW
  • Yes but the printParentPagesBreadcrumb prints all the breadcrumbs, I only wanted one up from it :)

    Cheers

    GW
  • Hmmm... wonder if you could array the output of it. The other option would be to do as I intially put and extract the title via the pageparentid.

    I'll see if I can come up with something that does that for yah.
  • acrylian Administrator, Developer
    It helps to look at the documentation sometimes, guys! If you check this link
    http://www.zenphoto.org/documentation/elementindex.html (top right on the main doc page) you can search all functions via the browser search.

    So 1.3.1.2 has:
    http://www.zenphoto.org/documentation/plugins/zenpage/_zp-extensions---zenpage---zenpage-functions.php.html#functiongetParentPages

    In the nighty/coming 1.3.2 this usage is incorporated into the object model to be more consequent (the usage of the above is actually the same except the first line):
    `
    $parents = $pageobj->getParents();
    if(is_array($parents)) { // to be sure there are parents!
    $directparent = $parents[0] // direct parent page titlelink
    $parentpage = new ZenpagePage($directparent);
    echo $parentpage->getTitle();
    }
    `
  • I was just looking through the index right now for hints, lol. Hadn't done that in a few versions. Thanks for that acrylian.

    Nice to know I was on the right path though :)
  • Acrylian, please be assured I do read and 'try' to understand the documentation. While I am learning my knowledge of php is still lacking, especially when I get confused between classes and how those classes are activated within certain functions.

    Most of my reaches out for help are due to my lack of being able to work it out for myself, but I do try, for quite some time too :)

    Thanks

    GW
  • acrylian Administrator, Developer
    Sure, just trying to motivate a little...;-)
Sign In or Register to comment.