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(); ?>
</h1>


The Result: /blog

siton
 
MrKDilkington replied on at Permalink Best Answer Reply
MrKDilkington
Hi siton,

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

http://documentation.concrete5.org/api/index.html...
MrKDilkington replied on at Permalink Reply
MrKDilkington
@siton

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:
http://documentation.concrete5.org/api/class-Concrete.Core.Page.Col...
http://documentation.concrete5.org/api/class-Concrete.Core.Page.Pag...