Php Zend_导航:如何为其他操作保存动态添加的页面?

Php Zend_导航:如何为其他操作保存动态添加的页面?,php,zend-framework,dynamic,zend-navigation,Php,Zend Framework,Dynamic,Zend Navigation,我正在与Zend_Navigation合作,为一个购物网站提供100多个参考资料。导航有一些静态页面,比如“产品”页面。某些页面是动态创建的,例如,当用户转到产品页面时,导航页面将在产品操作中创建: $pageToAdd = array ( 'label' => 'Product 01', 'controller' => 'productController', 'action' => 'productAction' ); $this->view-

我正在与Zend_Navigation合作,为一个购物网站提供100多个参考资料。导航有一些静态页面,比如“产品”页面。某些页面是动态创建的,例如,当用户转到产品页面时,导航页面将在产品操作中创建:

$pageToAdd = array (
    'label' => 'Product 01',
    'controller' => 'productController',
    'action' => 'productAction'
);
$this->view->navigation()->findByLabel('Products');
这个很好用。然后,对于每个产品,用户可以获得另一个页面,其中包含与该产品相关的选项,我想在先前创建的页面中添加另一个页面。因此,在“选项产品”行动中,我做了同样的事情:

$pageToAdd = array (
    'label' => 'Option for product 01',
    'controller' => 'productController',
    'action' => 'optionsProductAction'
);
$this->view->navigation()->findByLabel('Product 01');
但此时,导航中不再存在上一页“Product 01”。它只包含静态页面“Products”,我找不到如何在两个操作之间“保存”导航。

导航容器本身不保存

轻松工作的最快方式

从动作控制器的preDispatch方法的req参数中查找productId id。 如果存在-将正确的产品页面链接添加到Zend_导航实例