Search the Community
Showing results for tags 'nav'.
-
Hi Trying to setup a customized navigation. Page tree looks like this: home – upcoming exhibitions –– exhibition 1 –– exhibition 2 –– … – about – archive –– arch 1 –– arch 2 –– … – impressum Now I'd like to have a navigation, that lists only the subnav of "upcoming exhibitions" but not the one of "archive". I modified a snippet I found here in the forum. It looks like this so far: <nav class="mainNav"> <ul> <?php $homepage = $pages->get('/'); // first item links to the homepage echo "<li><a href='$homepage->url'>Aktuelle Ausstellung / current exhibition</a></li>"; $children = $homepage->children(); // render an <li> for each top navigation item foreach ( $children as $child ) { if ( $child->id == $page->rootParent->id ) { // this $child page is currently being viewed (or one of it's children/descendents) // so we highlight it as the current page in the navigation echo "<li class='active'><a href='$child->url'>$child->title</a></li>"; // if upcoming page has children, list them } elseif($child->id == 1020 && count($child->children)){ // build the subnav and list all items echo "<li><a href='$child->url'>$child->title</a><ul class='upcoming'>"; foreach($child->children as $c){ echo "<li><a href='$c->url'>$c->title<br>{$c->date_from}–{$c->date_to}</a></li>"; } echo "</ul><li>"; // otherwise list only main items } else { echo "<li><a href='$child->url'>$child->title</a></li>"; } } ?> </ul> </nav> This puts out the navigation as wanted, but only for main items (see fig. nav-open.png). As soon as "upcoming exhibitions" or one of its children is active, the navigation collapses (see fig. nav-closed.png). I cannot find out, where I went the wrong way. Thanks for help.
-
I'm creating a menu for a site, I need to take pages url and title as follows STUDENTS MALE PETER JACOB ALDO FEMALE ANNA FRANCESCA I need to take up the third child 1st node STUDENTS 2nd node MALE/FEMALE 3rd node PETER/JACOB... if u use this code $sc = $pages->get("/students/"); $children = $sc->children; echo '<ul>'; foreach($children as $child) { $child === $page->rootParent; echo "<li><a href='{$child->url}'>{$child->title}</a></li>"; } echo '</ul>'; I obtain MALE/FEMALE, how I can take PETER/JACOB and others??? thank u