I am rendering the top-level elements of a Zend Navigation object in one place like this:
echo $this->navigation()->menu()->setMaxDepth(0);
<
If I got your question right, this is how I do it:
print $this->navigation()->menu()->renderMenu(null, array(
'minDepth' => 1,
'maxDepth' => 1,
'onlyActiveBranch' => true,
'renderParents' => false));
Renders only the submenu of currently active menu.
I do something similar. My main navigation is handled with something like this...
$this->navigation()->menu()->setPartial('tabs.phtml');
echo $this->navigation()->menu()->render();
Then in my tabs.phtml I iterate over the container like so...
if (count($this->container)) {
foreach($this->container as $page) {
if ($page->isVisible()) {
if ($page->isActive(true)) {
$subcontainer = $page->getPages();
foreach($subcontainer as $subpage) {
// echo my link
}
}
}
}
}
I hope that helps a bit.
I do it this way:
<?php
// Render top-level elements
echo $this->navigation()->menu()->setMaxDepth(0);
// Render 2nd level elements for active element
echo $this->navigation()->menu()
->setOnlyActiveBranch(true)
->setRenderParents(false)
->setMinDepth(1);
?>
but this is not a good solution. Better one for each level as a separate menu:
<!-- level 1 -->
<?php echo $this->navigation()->menu()->setMaxDepth(0); ?>
<!-- level 2 -->
<?php echo $this->navigation()->menu()->setOnlyActiveBranch(true)->setRenderParents(true)->setMinDepth(1)->setMaxDepth(1); ?>
<!-- level 3 -->
<?php echo $this->navigation()->menu()->setOnlyActiveBranch(true)->setRenderParents(false)->setMinDepth(2)->setMaxDepth(2); ?>