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 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥100 已有python代码,要求做成可执行程序,程序设计内容不多
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助
  • ¥15 STM32控制MAX7219问题求解答