Topic: Menu with unlimited levels and children
Hi modify suckerfish menu for wolf... it works perfectly!
So I would like to assign a CSS class for (the same as PERCIFORMES! example)
class="daddy" for sub pages which have children
Here's the code
<?php
function displayChildren($page, $current, $startmenu = true, $limits = null) {
if ($limits != null && array_key_exists($page->slug, $limits)) {
$arr = array('order' => 'position ASC, published_on DESC', 'limit' => $limits[$page->slug]);
} else
$arr = array('order' => 'position ASC, published_on DESC');
if ($page && count($page->children()) > 0) {
echo ($startmenu) ? '<ul>' : '';
foreach($page->children($arr) as $menu) :
echo '<li'.(in_array($menu->slug, explode('/', $current->url)) ? ' class="current"': null).'>'.$menu->link($menu->title);
displayChildren($menu, $current, true, $limits);
echo '</li>';
endforeach;
echo ($startmenu) ? '</ul>' : '';
}
}
?>
<div id="container">
<h3>Pour WOLF</h3>
<?php
$page = $this->find('/');
echo '<ul id="nav">';
echo '<li>'.$page->link($page->title, (in_array($page->slug, explode('/', $this->url)) ? ' class="current"': null)).'</li>';
echo displayChildren($page, $this, false);
echo '</ul>';
?>
</div>
</div>http://wolfcms.office-web.net/


