Rendering Active Branch of Zend Navigation Without Top Level

后端 未结 3 825
刺人心
刺人心 2021-01-15 12:50

I am rendering the top-level elements of a Zend Navigation object in one place like this:

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


        
3条回答
  •  有刺的猬
    2021-01-15 13:42

    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.

提交回复
热议问题