New feature - parentMethod

This commit is contained in:
dignajar 2015-11-24 22:48:19 -03:00
parent bbfa1fb48e
commit 20432dbf43

View File

@ -147,6 +147,7 @@ class Page extends fileContent
return '/'.$htmlPath.'/'.$tmp;
}
// Returns the parent key, if the page doesn't have a parent returns FALSE.
public function parentKey()
{
$explode = explode('/', $this->getField('key'));
@ -157,6 +158,18 @@ class Page extends fileContent
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()
{
$tmp = array();