level one: Home, Galleries, Statement
level two: Set 1, Set 2, Set 3 etc. (under Galleries)
level three: a template that cycles through the child photos of Set 1, Set 2 or Set 3 set by using this code:
if ($page->prev->id) {
echo "<a href='{$page->prev->url}'></a>";
} else {
$lastpage = $page->siblings->last();
echo "<a href='$lastpage->url'></a>";
}
echo "<a href='{$page->parent->url}'></a>";
if ($page->next->id) {
echo "<a href='{$page->next->url}'></a>";
} else {
$firstpage = $page->siblings->first();
echo "<a href='$firstpage->url'></a>";
}
echo "<img class='centered' src ='{$page->images->first()->url}'";
The level one and two navigation menus show the the active links as "on" and highlighted according to my CSS declarations at level two. For example:Home Galleries Statement
[Set One] [Set Two] [Set Three]
[Thumbnail 1] [Thumnail 2] [Thumbnail 3]
But clicking on the Thumnail 2 and cycling through turns off the Set Two link:
Home Galleries Statement
[Set One] [Set Two] [Set Three]
<prev [image detail] next>
What do I need to add or change to make the second level navigation show as being "on"?
This is the code I am using in the header included in all templates at level 1, 2, and 3:
<div id="primary-menu">
<?php
// Create the top navigation list by listing the children of the homepage.
// If the section we are in is the current (identified by $page->rootParent)
// then note it with <a class='on'> so we can style it differently in our CSS.
// In this case we also want the homepage to be part of our top navigation,
// so we prepend it to the pages we cycle through:
$homepage = $pages->get("/");
$children = $homepage->children;
$children->prepend($homepage);
foreach($children as $child) {
$class = $child === $page->rootParent ? " class='on'" : '';
echo "<a$class href='{$child->url}'>{$child->title}</a>";
echo " ";
}
?>
</div>
<div id="secondary-menu">
<?php
echo "<hr>";
// Output subnavigation
//
// Below we check to see that we're not on the homepage, and that
// there are at least one or more pages in this section.
//
// Note $page->rootParent is always the top level section the page is in,
// or to word differently: the first parent page that isn't the homepage.
if($page->path != '/' && $page->rootParent->numChildren > 0) {
// We have determined that we're not on the homepage
// and that this section has child pages, so make navigation:
foreach($page->rootParent->children as $child) {
$class = $page === $child ? " class='on'" : '';
echo "<a$class href='{$child->url}'>{$child->title}</a>";
echo " ";
}
echo "<hr>";
}
?>













