General
Getting & Giving Support
Administration
Design
- Tut. - Layouts and Themes
- Tut. - Navigation cookbook
- Tut. - How To section
Reference Material
Plugin Development
- Tut. - Writing a plugin
- Ref. - List of Events
- Ref. - Enabling cron jobs
- Ref. - PHPDoc
Core Development
- Ref. - PHPDoc
Press information
Wolf CMS books section
Recipe: "Rolling" navigation in sidebar
This system works to any depth of levels you choose to use, but it only gives the navigation from the current page. It is “navigation lite”; it will always point from the current page “up” to its parent (if there is one), and always point “down” from the current page to its children (if there are any). It offers a nice secondary navigation system, complementing the main top-level navigation that Wolf gives by default. The menu looks something like this:
Classical
↑
Baroque
↳ Bach
↳ Telemann
↳ Vivaldi
Use this code in your site’s layout: it will not work as an “inherited” snippet. You can either put this code in the layout itself, or make a snippet for it, but call the snippet, e.g.,
<?php $this->includeSnippet('extra_nav') ?>
in the layout. Include it inside the sidebar DIV, probably best at the top, but you can put it anywhere you like:
<!-- START SUBNAV SYSTEM --> <p> <?php if ($this->level() != 0) { echo $this->parent->link($this->parent->title()).'<br />↑<br />'; } ?> <?php echo $this->title(); ?> <?php if (count($this->children()) > 0 && $this->title() != 'Articles') { echo '<br />'; foreach($this->children() as $subMenu): echo '↳ '.$subMenu->link($subMenu->title, (in_array($subMenu->slug, explode('/', $this->url)) ? ' class="current"': null)).'<br />'; endforeach; }; echo (count($this->children()) > 0 && $this->slug() == 'articles') ? '<br />↓' : ''; ?> </p> <!-- END SUBNAV SYSTEM -->
This menu system:
- checks to see whether you are “Home”, in which case the “upward” navigation is omitted;
- checks to see whether it is your “Articles” page,1) and if it is, points only to the Monthly Archives which are (by default) beneath it;
- prints the current page title (unlinked, of course);
- lists all the subpages to the current page with links.
You can always change the arrows/layout, etc., as you please. Note that this approach does not use a <ul>, but just a series of <br />’s.
