Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok I suspect the "default behaviour" of Zend_Navigation is the use case where the entire menu tree is required to be rendered on every page. In this use case the menu's children will be displayed as drop downs using CSS/JS. In this scenario the "strange" behaviour you described actually makes sense. </p> <p>Your use case is different in that you are using a mainmenu along with a submenu. This is similar to a topbar + sidebar implementation. In this scenario it is obviously not desirable for the entire menu tree to be rendered on every page. </p> <p>To further confuse the issue it seems that renderSubmenu() has some unexpected behaviour in that it will render the root level of the menu, when an active branch has no children. Some have have reported this behaviour as a <a href="http://framework.zend.com/issues/browse/ZF-6978" rel="nofollow">bug</a>. <a href="http://framework.zend.com/issues/browse/ZF-6673?focusedCommentId=31005&amp;page=com.atlassian.jira.plugin.system.issuetabpanels%3acomment-tabpanel#comment-31005" rel="nofollow">Here</a> you will find a comment suggesting something similar to your "hack"</p> <p>So in summary, your "hack" seems to be a valid approach to make a single container render correctly for your specific use case. If you really want something more elegant, you could perhaps consider: </p> <ol> <li>Using one of the findBy* methods to "extract" your submenu as new container as per <a href="http://framework.zend.com/manual/1.11/en/zend.view.helpers.html#zend.view.helpers.initial.navigation.menu" rel="nofollow">Example 40</a></li> <li>Splitting the mainmenu and submenu into separate containers and manage the relationship in a piece of code somewhere</li> <li>Extending Zend_Navigation_Container to enforce the desired behaviour </li> <li>Using a partial</li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload