Documentation

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

Standard navigation with styling on LI

The standard main navigation for Wolf's default layouts has the “current” styling added to the anchor tag. (In the “Wolf” layout, this code is in the layout itself; in the “Simple” layout, it is in the “header” snippet.) Often, however, styles require the “current” class to be attached to the <li …> tag, rather than the anchor.

This code is Wolf's default navigation, but with the simple transformation of styling the li tag:

<div id="nav">
 <ul>
   <li<?php echo url_match('/') ? ' class="current"': ''; ?>><a href="<?php echo URL_PUBLIC; ?>">Home</a></li>
     <?php foreach($this->find('/')->children() as $menu): ?>
       <li <?php echo in_array($menu->slug(), explode('/',  $this->url(false))) ? ' class="current"': null; ?>>
      <?php echo $menu->link($menu->title()); ?></li>
      <?php endforeach; ?> 
    </ul>
  </div> <!-- end #navigation -->
 
navbook/styledlist.txt · Last modified: 2015-04-03 22:37 by David
 
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Copyright 2010 wolfcms.org / design by yello studio / Wolf CMS Inside