I am trying to separate which pages display on the header menu and those which appear on footer menu. For that I created two checkbox fields, applied them to the templates, and now I am trying to filter them in the menu list.
Here's my code:
<?php
[b]$homepage = $pages->get("/")->find("visibility_in_top_menu=1");[/b]
$children = $homepage->children;
// $children->prepend($homepage);
$i = count($children)-1;
foreach($children as $child) {
$class = $child === $page->rootParent ? " class='on'" : '';
if($i>0){echo "<li><a$class href='{$child->url}'>{$child->title}</a></li>";}
else {echo "<li><a$class href='{$child->url}' id='last'>{$child->title}</a></li>";}
$i-=1;
}
?>
The thing is that I am probably not setting up the first line well.
Can anybody help me out?
Thanks!













