Zend_navigation:将自定义分部与选择容器相结合


Zend_navigation: combine custom partial with selecting container

我正在用自定义分部呈现菜单,但我需要多个菜单,所以我想为每个视图选择特定的容器,但renderMenu($container)会覆盖setPartial()

有没有任何方法可以选择容器并用我的部分呈现它的内容?

renderMenu()不应该使用setPartial()设置。为了渲染部分,请尝试使用renderPartial,这里是api:

//class Zend_View_Helper_Navigation_Menu extends Zend_View_Helper_Navigation_HelperAbstract
public function renderPartial(Zend_Navigation_Container $container = null,
                                  $partial = null)

因此,使用此方法时可以指定容器和分部,而无需严格注册容器或使用setPArtial()。