views:

356

answers:

1

i have this xml file for Creating a container , if i want create a db for save this items and and create container from db how should i do ?

<?xml version="1.0" encoding="utf-8"?>

<config>
    <nav>
        <logout>
            <label>logout</label>
            <controller>authentication</controller>
            <action>logout</action>
            <resource>logout</resource>

        </logout>


        <login>
            <label>login</label>
            <controller>authentication</controller>
            <action>login</action>
            <resource>login</resource>

        </login>
        <test>
            <label>test</label>
            <uri>#</uri>
            <resource>test</resource>
            <pages>
                <list>
                    <label>list</label>
                    <controller>tset</controller>
                    <action>listtest</action>
                </list>

                <archive>
                    <label>archive</label>
                    <controller>myarchive</controller>
                    <action>archive</action>
                </archive>
            </pages>
        </test>
      </nav>
</config>

and code in bootsrap

$navContainerConfig = new Zend_Config_Xml(APPLICATION_PATH . 'navigation.xml', 'nav');

$navContainer = new Zend_Navigation($navContainerConfig);
+1  A: 

Why do you need to store this in database?

If you really need, the best way is nested set.

You may also just serialize the array and save to the database.

You may also use Zend_Config_Xml_Writer instead of the database.

takeshin