getting all parents of a page

Permalink
Hey All,
I'm working on a package that involves overlapping "zones" of context, based on a page's location in the site. To do this i need to know all of a page's parents IDs all the way to Home. I've done it like so:

<?php
function getAllParentIDs($cID){
    $parents = array();
    array_push($parents, $cID);
    $current_page = Page::getByID($cID);
    $curr_id = $current_page->getParentID();
    while($curr_id != 0){
        array_push($parents, $curr_id);
        $current_page = Page::getByID($curr_id);
        $curr_id = $current_page->getParentID();
    }
    return $parents;
}
?>


is there an internal c5 function that does this? I thought Page::getCollectionParentIDs() might do the trick but it seems that it only returns the same value as Page::getParentID() in an array. Maybe i'm using it incorrectly?

 
malthoff replied on at Permalink Best Answer Reply
malthoff
Thanks for your code.
What C5 5.5 is concerned replace
getParentID()
with
getCollectionParentID()
. Then it works.