Link to grandparents background image

Permalink
Dear Forum.

I can get parents attribute values:
$parent = $c->getCollectionParentID();
$parentname = Collection::getByID( $parent );
$parent_title = $parentname->getAttribute( 'pagetitle' );


I also can do that with the grandparents attribute values.

But how can I get the relative path to an image attribute ("bg_image") of a grandparent page to display it on the grandchild page?

Best
Mathias

MathiasB
 
enlil replied on at Permalink Reply
enlil
Haven't tested for purity but this should lead you in the right direction...

<?php
$imgID = $grandparent->getAttribute('bg_image');
$imgFile = \Concrete\Core\File\File::getByID($imgID);
$url = $imgFile->getURL();
?>