List only second level below?
Permalink
I need a PageList or Nav that only lists pages two levels below current.
I cant do this with the autonav, because I get all levels below.
How can I make a template for this, that ignores the level directly under the current page, but lists all children in every subpage?
Thank you.
I cant do this with the autonav, because I get all levels below.
How can I make a template for this, that ignores the level directly under the current page, but lists all children in every subpage?
Thank you.
if you set the exclude from nav custom attribute on for a page, the autonav wont list that page
but your controller has $c available, so you basically do:
$firstLevelKids = $c->getCollectionChildrenArray(1);
$grandKids = array();
foreach($firstLevelKids){
$grandKidsArray = Page::getByID($firstLevelKids)->getCollectionChildenArray(1);
foreach($grandKidsArray){
$grandKids[] = Page::getByID($grandKidsArray);
}
}
$grandKids should be filled with second level page objects.
oh and make sure all that stuff is arrays using checks for is_array so it doesn't die on em.
$firstLevelKids = $c->getCollectionChildrenArray(1);
$grandKids = array();
foreach($firstLevelKids){
$grandKidsArray = Page::getByID($firstLevelKids)->getCollectionChildenArray(1);
foreach($grandKidsArray){
$grandKids[] = Page::getByID($grandKidsArray);
}
}
$grandKids should be filled with second level page objects.
oh and make sure all that stuff is arrays using checks for is_array so it doesn't die on em.