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
DavidCOG's Stuff
Code Snippets
Display all children of this page:
<ul> <?php foreach ($this->children() as $child): ?> <li><?php echo $child->link($child->title, (url_start_with($child->url) ? ' class="current"': null)); ?></li> <?php endforeach; ?> </ul>
Display all children of specified page:
<ul>
<?php foreach($this->find('about-us')->children() as $menu): ?>
<li><?php echo $menu->link(); ?></li>
<?php endforeach; ?>
</ul>
Side menu which appears only when parent has children:
<?php foreach($this->find('/')->children() as $topPage): ?>
<?php if (in_array($topPage->slug, explode('/', $this->url))) { $thisPage = $topPage->slug; } ?>
<?php endforeach; ?>
<?php
if (count($this->find($thisPage)->children()) > 0 && $this->level() > 0) {
echo '<ul class="sidemenu">';
foreach($this->find($thisPage)->children() as $menu): ?>
<li<?php echo (url_start_with($menu->url)) ? ' class="current"': null; ?>><?php echo $menu->link(); ?></li>
<?php endforeach;
echo '</ul>';
}
?>
call from layout with:
<?php $this->includeSnippet('sidemenu'); ?>
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
