zenphoto forums » General Zenphoto Discussion

Print Parent Page Title?

(9 posts)

Tags:

  1. gwmbox

    Contributor
    Joined: Apr '07
    Posts: 170

    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

    Posted 2 years ago #
  2. micheall

    Contributor
    Joined: Aug '09
    Posts: 513

    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.

    Posted 2 years ago #
  3. gwmbox

    Contributor
    Joined: Apr '07
    Posts: 170

    Resolved, well sort of... I have used the Custom Data field :)

    Cheers

    GW

    Posted 2 years ago #
  4. gwmbox

    Contributor
    Joined: Apr '07
    Posts: 170

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

    Cheers

    GW

    Posted 2 years ago #
  5. micheall

    Contributor
    Joined: Aug '09
    Posts: 513

    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.

    Posted 2 years ago #
  6. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,343

    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();
    }
    Don't forget to read the Forum rules and usage resources
    Posted 2 years ago #
  7. micheall

    Contributor
    Joined: Aug '09
    Posts: 513

    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 :)

    Posted 2 years ago #
  8. gwmbox

    Contributor
    Joined: Apr '07
    Posts: 170

    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

    Posted 2 years ago #
  9. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,343

    Sure, just trying to motivate a little...;-)

    Don't forget to read the Forum rules and usage resources
    Posted 2 years ago #

RSS feed for this topic

Reply

You must log in to post.