doumu1951 2011-02-15 21:33
浏览 31

Zend_Navigation渲染子菜单

I have the following Zend_Navigation config

-Item1
-Item2
   |---SubItem2 1
   |---SubItem2 2
   |---SubItem2 3 (Visible = false)
-Item3
   |---SubItem3 1
   |---SubItem3 2
-Item4
   |---SubItem4 1

Now, in application, whenever the user is on SubItems (visible = true), the submenu renders correctly. But whenever the user is on invisibale page like "SubItem2 3". The submenu does not render.

I can render the breadcrumbs by doing setRenderInvisible() and it works.

I was not able to render the submenu.

Following is the code I use to render the menu and sub-menu.

It is in the layout file.

           <div id="top-nav-menu">
           <?php echo $this->navigation()->menu()->setMaxDepth(0)->setUlClass('topNav'); ?>
       </div>
       <div class="clear"></div>

       <div id="sub-nav-menu">
            <?php echo $this->navigation()->menu()->setMaxDepth(1)->setMinDepth(1)->setOnlyActiveBranch(true)->setUlClass('subNav') ; ?>
            <p style="display:inline;">&nbsp;</p>
       </div>

Any information/pointers are appreciated.

Thanks,

  • 写回答

1条回答 默认 最新

  • dongxietao0263 2011-02-16 23:58
    关注

    Alright, was able to resolve this with some information from another questions: Zend_Navigation with hidden Pages

    The main issue was that when visible = false, there was no active page. As a result of this, no menu items were rendered. So now in a controller helper, apart from what is suggested in the other thread, I also check if any page is active. If no page is active, I set the default page as active and menu renders fine.

    Hope this helps someone. Thanks!

    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大