开发者

Zend_Navigation : how to make dynamically added page saved for other actions?

开发者 https://www.devze.com 2023-03-30 03:08 出处:网络
I\'m working with Zend_Navigation for a shopping site with 100+ references. The Navigation has some static pages, like the \'Products\' one. Some pages are dynamically created, for instance, when the

I'm working with Zend_Navigation for a shopping site with 100+ references. The Navigation has some static pages, like the 'Products' one. Some pages are dynamically created, for instance, when the user goes to a product page, the navigation page is created in the product action:

$pageToAdd = array (
    'label' => 'Product 01',
    'controller' => 'productController',
    'action' => 'productAction'
);
$this->view->navigation()->findByLabel('Products');

This works fine. Then, for each product, the user can get another page with options relative to the product, and I'd like to add another page to the previously created. So, in the 'options-product' action, I do the same thing:

$pageToAdd = array (
    'label' => 'Option for product 01',
    'controller' => 'productController',
    'action' => 'optionsProductAction'
);
$this->view->navigation()->findByLabel('Product 01');

But at this time, the previous page ('Product 01') does not exist anymore in the navigation. It only contains the static page 'Products', and I cannot fin开发者_C百科d how to have the navigation 'saved' between the 2 actions.


navigation containers isnt saves themself

fastest way for easy jobs

find productId id from req params at preDispatch() method of your action controller. if exists - add a right product page link to Zend_Navigation instance

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号