New feature - parentMethod

This commit is contained in:
dignajar 2015-11-24 22:48:19 -03:00
parent bbfa1fb48e
commit 20432dbf43
1 changed files with 13 additions and 0 deletions

View File

@ -147,6 +147,7 @@ class Page extends fileContent
return '/'.$htmlPath.'/'.$tmp; return '/'.$htmlPath.'/'.$tmp;
} }
// Returns the parent key, if the page doesn't have a parent returns FALSE.
public function parentKey() public function parentKey()
{ {
$explode = explode('/', $this->getField('key')); $explode = explode('/', $this->getField('key'));
@ -157,6 +158,18 @@ class Page extends fileContent
return false; return false;
} }
// Returns the parent method output, if the page doesn't have a parent returns FALSE.
public function parentMethod($method)
{
global $pages;
if( isset($pages[$this->parentKey()]) ) {
return $pages[$this->parentKey()]->{$method}();
}
return false;
}
public function children() public function children()
{ {
$tmp = array(); $tmp = array();