parent page attributes

Permalink 2 users found helpful
Hello,

I'm reading a custom attribute with
$c->getCollectionAttributeValue('sams')

how, can I read the same one from the page's parent? and then from parent's parent?

I need actually to recursively get up to the site root and read all of them.

Thanks,
Laurian

 
jordanlev replied on at Permalink Reply
jordanlev
Just in case someone is looking for this in the future, try:
$page = Page::getById($c->getCollectionID());
$parentID = $page->getCollectionParentID();
$parent = Collection::getByID($parentID);
$parent->getCollectionAttributeValue('sams');
//etc...
msglueck replied on at Permalink Reply
msglueck
thanks a lot! exactly what I needed!! ;)