Get the parent page full URL

Permalink 1 user found helpful
I want to create "UP" button (go one level back - like in next/prev block). In other posts i only find 5.6 solution.

I am her: home > blog > blog entry

In blog_entry.php i put this two lines:
<h1><!--parent link-->
<?php  $parent = Page::getByID($c->getCollectionParentID(), 'ACTIVE'); ?>;
<?php echo $parent->getCollectionPath(); ?>

The Result: /blog

View Replies: View Best Answer
MrKDilkington replied on at Permalink Best Answer Reply
Hi siton,

You can try this:
$parent = Page::getByID($c->getCollectionParentID());
$parentLink = $parent->getCollectionLink();
<a href="<?php echo $parentLink; ?>">Up</a>
siton replied on at Permalink Reply
Thanks. How to use the API to see all of this methods?
MrKDilkington replied on at Permalink Reply

In page templates, the current page object is available as the variable $c. In block templates, you can get the current page object using $c = Page::getCurrentPage();.

With the current page object, I believe you can use methods in classes like these: