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: Inline (horizontal) navigation
This is simply a horizontal variation of the preceding (vertical) “recipe”. Again, use this code in your site’s layout (it will not work as an “inherited” snippet). Also like the preceding example, it will always point from the current page “left” to its parent (if there is one), and always point “right” from the current page to its children (if there are any).
Classical ← Baroque → Bach | Telemann | Vivaldi |
One difference from the preceding is that if the current page is “Articles”, then it will point at monthly archive links produced by the navigation code itself, and not the sidebar's default archive listing.
<!-- START INLINE NAV --> <?php $post = $this->find('articles'); ?> <?php $all_posts = $post->archive->archivesByMonth(); ?> <div id="inlineNav"> <p> <?php if ($this->level() != 0) { echo $this->parent->link($this->parent->title()).' ← '; } ?> <?php echo $this->title(); ?> <?php if (count($this->children()) > 0 && $this->title() != 'Articles') { echo ' → '; foreach($this->children() as $inlineMenu): echo ''.$inlineMenu->link($inlineMenu->title, (in_array($inlineMenu->slug, explode('/', $this->url)) ? ' class="current"': null)).' |'; endforeach; }; if ($this->children() > 0 && $this->slug() == 'articles') { echo '→ '; foreach ($all_posts as $post_date): echo '<a href="'.$this->url.'/'.$post_date.URL_SUFFIX.'"> '.strftime('%B %Y', strtotime(strtr($post_date, '/', '-'))).'</a> |'; endforeach; } ?> </p> </div><!-- end #inlineNav --> <!-- END INLINE NAV -->
This codes functions just the same as the "Rolling Vertical" navigation, except for the variation with the monthly archive listing for “Articles”: if you have changed the name of your Articles page to “News” (or whatever), you will need to change the all the occurrences of “A/articles” in the subnav code to the new name (e.g. N/news).
