1

有没有像这样使用 Zend_Navigation (xml) 创建页面结构的方法:

- 1. Dashboard
- - 1.1 New article
- - 1.2 New user
- - 1.3 New products
- 2. Articles
- - 2.1 New article
- - 2.2 Reviews
- 3. User
- - 3.1 New user
- - 3.2 Etc Etc...
-
-

- 我正在尝试通过这个 XML(示例 xml)来做,但它出乎意料地工作,因为在文章页面上加载了 Dashborad 的页面,并且两个页面(Artcile 和 Dashboards)都处于活动状态:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <navigation>
        <dashboard>
            <label>Dashboard</label>
            <module>admin</module>
            <controller>index</controller>
            <action>index</action>
            <pages>
                <add>
                    <label>New</label>
                    <module>admin</module>
                    <controller>recension</controller>
                    <action>add</action>
                </add>
            </page>
        </dashboard>
        <articles>
            <label>Articles</label>
             <module>admin</module>
             <controller>articles</controller>
             <action>index</action>
            <pages>
                <overview>
                    <label>Preview</label>
                    <module>admin</module>
                    <controller>articles</controller>
                    <action>index</action>
                </overview>
                <add>
                    <label>New</label>
                    <module>admin</module>
                    <controller>articles</controller>
                    <action>add</action>
                </add>
             </pages> 
        </articles>     
    </navigation>
</config>

感谢您的任何建议。

4

1 回答 1

1

它可以正常工作。Zend_Navigation 将页面设置为活动的,因为它是活动的。如果您在不同的地方有相同的页面并且不希望它们同时处于活动状态,则意味着您的导航设计不佳。

有两种解决方法

  1. 定义更多的zend导航容器——但使用起来并不容易
  2. 向页面添加其他参数,例如 rel=dashbord 以确定单个活动页面

会是这样的

<dashboard>
    <label>Dashboard</label>
    <module>admin</module>
    <controller>index</controller>
    <action>index</action>
    <pages>
        <add>
            <label>New</label>
            <module>admin</module>
            <controller>recension</controller>
            <action>add</action>
            <params>
                <rel>dashboard</rel>
            </params>
        </add>
    </page>
</dashboard>
于 2010-11-11T15:12:09.087 回答