开发者

How does one register a non menu page with Zend_Navigation?

I have an access denied page, which should not be shown in menus. However, it's possible for the user to be redirected to the access denied page.

I also ha开发者_开发技巧ve a breadcrumbs section on the page, and if you go to the access denied page, it shows as blank, which is extremely ugly.

I would therefore like to register the page, but not have the page visible on the menu. I tried setting the visible property to false, but when I do that the breadcrumbs still do not show correctly (though the item is removed from the menu)

How can I register the page but not show it in menus?


You can add the menu at all time and set the breadcrumbs to render also invisible pages:

echo $this->navigation()->breadcrumbs()->setRenderInvisible(true)

The other method is not to add the page at all time in the menu, but use the init() method of the errorController to add the page (so it's added only when it needs to be):

controller ErrorController extends Zend_Controller_Action
{
    public function init ()
    {
        $params = array(); // Add here the options you want
        $page = new Zend_Navigation_Page($params);

        $container = $this->view->navigation()->getContainer();
        $container->addPage($page);
    }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜