Trace: » howto » accesskey » collapsing » inline-horizontal » leave-out » rolling-vertical » simple » sitemap-style » stacking-collapsing » styledlist
Translations of this page?:
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
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)) ? ' class="current"': null; ?>><?php echo $menu->link($menu->title); ?></li> <?php endforeach; ?> </ul> </div> <!-- end #navigation -->
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
