Skip to content

Instantly share code, notes, and snippets.

@hissy
Created April 14, 2013 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hissy/5382055 to your computer and use it in GitHub Desktop.
Save hissy/5382055 to your computer and use it in GitHub Desktop.
#concrete5 テーマ・テンプレートから、現在見ているページの親ページのリンクを表示
<?php
$th = Loader::helper('text');
$nh = Loader::helper('navigation');
$page = Page::getCurrentPage();
$parent = Page::getByID($page->getCollectionParentID());
// $parent = Page::getByPath("/example"); // パス決め打ちで取得したい場合
if(is_object($parent)){
$parentLink = $nh->getCollectionURL($parent);
?>
<a href="<?php echo $parentLink?>">Back to <?php echo $th->entities($parent->getCollectionName())?></a>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment