zend_navigation and modules

Posted by Grant Collins on Stack Overflow See other posts from Stack Overflow or by Grant Collins
Published on 2010-04-01T20:36:03Z Indexed on 2010/04/02 16:43 UTC
Read the original article Hit count: 358

Hi,

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

© Stack Overflow or respective owner

Related posts about zend-framework

Related posts about php