views:

30

answers:

1

Is it possible to create a submenu in Zend Navigation?

At this time i've got this in my application.ini:

resources.navigation.pages.indexHome.label = "Home"
resources.navigation.pages.indexHome.controller = "index"
resources.navigation.pages.indexHome.action = "index"
resources.navigation.pages.indexLogin.label = "Login"
resources.navigation.pages.indexLogin.controller = "login"
resources.navigation.pages.indexLogin.action = "index"
resources.navigation.pages.indexRegister.label = "Register"
resources.navigation.pages.indexRegister.controller = "login"
resources.navigation.pages.indexRegister.action = "register"
resources.navigation.pages.indexDisclaimer.label = "Disclaimer"
resources.navigation.pages.indexDisclaimer.controller = "disclaimer"
resources.navigation.pages.indexDisclaimer.action = "index"
resources.navigation.pages.indexAbout.label = "About"
resources.navigation.pages.indexAbout.controller = "about"
resources.navigation.pages.indexAbout.action = "index"

But I want the login and register in a submenu of account.

Is that possible?

Thanks

A: 

To add a submenu, you should be able to do it by adding

resources.navigation.pages.indexAccount.label = "Account"
resources.navigation.pages.indexAccount.controller = "account"
resources.navigation.pages.indexAccount.action = "index"
resources.navigation.pages.indexAccount.pages.login.label = "Login"
resources.navigation.pages.indexAccount.pages.login.controller = "auth"
resources.navigation.pages.indexAccount.pages.login.action = "login"
resources.navigation.pages.indexAccount.pages.logout.label = "Logout"
resources.navigation.pages.indexAccount.pages.logout.controller = "auth"
resources.navigation.pages.indexAccount.pages.logout.action = "logout"

Try that... It's basically looking for the same structure as an XML configuration.

<?xml version="1.0" encoding="utf-8"?>
<config>
    <nav>
        <currentuser>
            <label>Current User</label>
            <uri></uri>
            <resource>dude</resource>
            <pages>    
            <logout>
                <label>Logout</label>
                <controller>auth</controller>
                <action>logout</action>
                <resource>logout</resource>
                <order>300</order>
            </logout>
            <login>
                <label>Login</label>
                <controller>auth</controller>
                <action>login</action>
                <resource>login</resource>
                <order>100</order>
            </login>
            </pages>
        </currentuser>
        <sitenav>
            <label>SiteNave</label>
            <uri></uri>
            <pages>
            <clients>
                <label>Clients</label>
                <controller>client</controller>
                <action>index</action>
                <resource>client</resource>
                <order>110</order>
            </clients>
            <users>
                <label>Users</label>
                <controller>user</controller>
                <action>index</action>
                <resource>user</resource>
                <order>200</order>
                <pages>
                    <user_create>
                        <label>Create</label>
                        <controller>user</controller>
                        <action>create</action>
                        <resource>user_create</resource>
                        <order>1</order>
                    </user_create>
                </pages>
            </users>
            </pages>
        </sitenav>
      </nav>
</config>
nvoyageur