How can i call the url of the projectpage when i want to link from subpage2?
projectpage
subpage1
subpage2
I can just link to subpage1 with:
<?php echo $page->parent()->url() ?>
Thanks for your help in advance
How can i call the url of the projectpage when i want to link from subpage2?
projectpage
subpage1
subpage2
I can just link to subpage1 with:
<?php echo $page->parent()->url() ?>
Thanks for your help in advance
Not ideal, but this should work:
$page->parent()->parent()->url()
If you need it more often, you can create a custom page method for it.
page::$methods['grandparent'] = function($page) {
return $page->parent()->parent();
};
Then you can use it like this:
$page->grandparent()->url()
Texnixe it works fine, Thanks!