zend_navigation and modules

丶灬走出姿态 提交于 2019-12-07 13:41:41

问题


I am developing an application at the moment with zend and I have seperated the app into modules.

The default module is the main site where unlogged in users access and have free reign to look around. When you log in, depending on the user type you either go to module A or module B, which is controlled by simple ACLs. If you have access to Module A you can not access Module B and visa versa. Both user types can see the default module.

Now I want to use Zend_Navigation to manage the entire applications navigation in all modules. I am not sure how to go about this, as all the examples that I have seen work within a module or very simple application.

I've tried to have my navigation.xml file look like this:

<configdata>
<navigation>

        <label>Home</label>
        <controller>index</controller>
        <action>index</action>
        <module>default</module>

        <pages>
            <tour>
                <label>tour</label>
                <controller>tour</controller>
                <action>index</action>
                <module>default</module>
            </tour>

            <blog>
                <label>blog</label>
                <url>http://blog.mysite.com</url>                   
            </blog>

            <support>
                <label>Support</label>
                <controller>support</controller>
                <action>index</action>
                <module>default</module>
            </support>

        </pages>

</navigation>
</configdata>

This if fine for the default module, but how would I go about the other modules to this navigation page? Each module has it's own home page, and others etc.

Would I be better off adding a unique navigation.xml file for each module that is loaded in the preDispatch plugin that I have written to handle my ACLs?? Or keep them in one massive navigation file?

Any tips would be fantastic.

Thanks,

Grant


回答1:


Grant,

I typically create a config directory under each module, and within there I place a navigation.xml document. This helps to mitigate cross dependency issues.



来源:https://stackoverflow.com/questions/2563502/zend-navigation-and-modules

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!