After reading the api it said that the submenu method is simply a proxy the
renderMenu method with certain variables set. For some reason the api does
not allow you to set properties on the call to the submenu method, which i
would have thought would be forwarded to the renderMenu method. This was the
problem as i found that all levels of the submenu would be rendered if the
maxDepth property was set - except you can't set this using renderSubMenu.
The following will also not work:
echo $this->navigation()->menu()->setMaxDepth(4)->renderSubMenu();
So I came up with the following solution for the submenu:
$rootPage = $this->navigation()->getContainer()->getPages();
foreach($rootPage as $page) {
if($page->isActive(true)) {
echo
$this->navigation()->menu()->renderMenu($page, array('maxDepth'
=> 4));
break;
}
}
It seems that the maxDepth variable needs to be set for it to render more
than one level deep, which is slightly counter-intuitive to me as i would
assume the default behaviour would render all children unless specified.
--
View this message in context:
http://n4.nabble.com/Rendering-nested-submenu-items-from-XML-file-tp1753813p1754807.html
Sent from the Zend Framework mailing list archive at Nabble.com.