I want to render a main menu (level zero),
and then, submenu items if current page has subpages.

I thought this should work:

<?php echo $this->navigation()->menu()->setMaxDepth(0); ?>
<?php echo $this->navigation()->menu()->renderSubMenu(); ?>

but, if the current page has no sub-pages,
submenu renders zero-level items.
(both menu and submenu are the same = duplicated, not necessary).

I solved this problem like that:

<?php echo $this->navigation()->menu()->setMaxDepth(0);
        if ($this->navigation()->menu()->setMaxDepth(0) !=   
$this->navigation()->menu()->renderSubMenu()): ?>
             <h2 class="aural header">Submenu</h2>
        <?php echo $this->navigation()->menu()->renderSubMenu(); endif; ?>

but this is not elegant way…

How to do it right?

-- 
regards
takeshin
-- 
View this message in context: 
http://www.nabble.com/Zend-Navigation-renderSubmenu-tp24937897p24937897.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to