I am rendering the top-level elements of a Zend Navigation object in one place like this:
echo $this->navigation()->menu()->setMaxDepth(0);
How do I render the navigation tree from the second level on down for the active branch? I've tried creating a partial that loops the $this->container
object, but I don't know how to determine if my current item is the active branch. Once I've determined that it's the active branch how do I render the menu? Am I doing this the hard way and missing something obvious?
Thanks!
UPDATE:
I accepted a solution because that's what I used, but I also would like to provide the answer to my actual question, for reference sake. ($this
is the view object)
// Find the active branch, at a depth of one
$branch = $this->navigation()->findActive($this->nav, 1, 1);
if (0 == count($branch)) {
// no active branch, find the default branch
$pages = $this->nav->findById('default-branch')->getPages();
} else {
$pages = $branch['page']->getPages();
}
$this->subNav = new Zend_Navigation($pages);
$this->subNav
can then be used to render the sub-menu.