New functions
Permalink
Hello Everyone.
Working on 5.7
I needed to know if a page had children that where not "Hidden" so i can do a custom AutoNav call depending on the results. So I added a new function
function getNumChildrenNotExcluded() to concrete/src/Page/Page.php
I know hacking the core is not ideal, how can i add a new function to my theme so that i can use it without hacking the core.
function getNumChildrenNotExcluded() {
// direct children only
$db = Loader::db();
$v = array($this->cID);
$num = $db->getOne('select distinct p.cID as total, cav.akID
from Pages p
left join CollectionAttributeValues cav on cav.cID=p.cID
where p.cParentID = ? and cav.akID=5', $v);
if ($num) {
return $num;
}
return 0;
}
Thanks
Working on 5.7
I needed to know if a page had children that where not "Hidden" so i can do a custom AutoNav call depending on the results. So I added a new function
function getNumChildrenNotExcluded() to concrete/src/Page/Page.php
I know hacking the core is not ideal, how can i add a new function to my theme so that i can use it without hacking the core.
function getNumChildrenNotExcluded() {
// direct children only
$db = Loader::db();
$v = array($this->cID);
$num = $db->getOne('select distinct p.cID as total, cav.akID
from Pages p
left join CollectionAttributeValues cav on cav.cID=p.cID
where p.cParentID = ? and cav.akID=5', $v);
if ($num) {
return $num;
}
return 0;
}
Thanks