douxie9471 2010-10-25 05:55
浏览 6
已采纳

如何使用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 have 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?

  • 写回答

1条回答 默认 最新

  • dtpw54085 2010-10-25 07:37
    关注

    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);
        }
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP