Light-weight, fast, simple and powerful!
Translations of this page?:

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.

<?php $post = $this->find('articles'); ?>
<?php $all_posts = $post->archive->archivesByMonth(); ?>
<div id="inlineNav">
    <?php if ($this->level() != 0) { echo $this->parent->link($this->parent->title()).' &#8592; '; } ?>
        <?php echo $this->title(); ?> 
        <?php if (count($this->children()) > 0 && $this->title() != 'Articles') {
            echo ' &#8594; ';
            foreach($this->children() as $inlineMenu):
            echo ''.$inlineMenu->link($inlineMenu->title, (in_array($inlineMenu->slug, explode('/', $this->url)) ? ' class="current"': null)).'&nbsp;|';
    if ($this->children() > 0 && $this->slug() == 'articles') {
	echo '&#8594; ';
	foreach ($all_posts as $post_date):
	echo '<a href="'.$this->url.'/'.$post_date.URL_SUFFIX.'"> '.strftime('%B %Y', strtotime(strtr($post_date, '/', '-'))).'</a>&nbsp;|';
</div><!-- end #inlineNav -->

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).

navbook/inline-horizontal.txt · Last modified: 2012-02-09 18:24 by David
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Copyright 2010 / design by yello studio / Wolf CMS Inside