This thread is a few months old, but I'd rather put it here than start a new
one, in case someone else stumbles across it.

While I'm good on using an XML file, how would I make an INI if I wanted to
use an INI file instead of XML?  Lets say I have this simple XML file, what
would the INI file look like?

<?xml version="1.0" encoding="UTF-8"?>
<configdata>
<nav>
        <home>
                <label>Home</label>
                <uri>/</uri>
        </home>
        <products>
                <label>Products</label>
                <uri>/products/</uri>
                <pages>
                        <widgets>
                                <label>Widgets</label>
                                <uri>/products/widgets/</uri>
                        </widgets>
                        <sprockets>
                                <label>Sprockets</label>
                                <uri>/products/sprockets/</uri>
                        </sprockets>
                </pages>
        </products>
        <aboutus>
                <label>About Us</label>
                <uri>/company/aboutus/</uri>
        </aboutus>
</nav>
</configdata>

Likewise, my Bootstrap.php class initalizes the XML file Zend_Navigation
like this:

$config = new Zend_Config_Xml(APPLICATION_PATH .
'/configs/navigation_uri.xml', 'nav');
$navigation = new Zend_Navigation($config);
$view->navigation($navigation);

How would that change if I was going to use the the new INI file?  I tried
this, but it's not working and I'm not sure where my understanding is
failing:

$config = new Zend_Config_Ini(APPLICATION_PATH .
'/configs/navigation_uri.ini');
$navigation = new Zend_Navigation($config);
$view->navigation($navigation);

configdata.nav.home.label     = Home
configdata.nav.home.uri       = /
configdata.nav.products.label = Products
configdata.nav.products.uri   = /products/
configdata.nav.products.pages.widgets.label = Widgets
configdata.nav.products.pages.widgets.uri   = /products/widgets/
configdata.nav.products.pages.sprockets.label = Sprockets
configdata.nav.products.pages.sprockets.uri   = /products/prockets/
configdata.nav.aboutus.label = About Us
configdata.nav.aboutus.uri   = /company/aboutus/

Cheers!
-- 
View this message in context: 
http://n4.nabble.com/Zend-Navigation-in-application-ini-in-ralphschindler-s-webninar-tp661093p960632.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to