I would organize my config like this:
 
<?xml version="1.0" encoding="UTF-8"?>
<config>
    <production>
        <database> 
              <type>mysqli</type>
            <params>
                <host>localhost</host>
                <port>3306</port>
                <username>root</username>
                <password></password>
                <dbname></dbname> 
            </params>
        </database>
        <debug>TRUE</debug>
    </production>
</config>

Then it's easy to use like this:
 
  $db = Zend_Db::factory($config->database->type,
$config->database->params);
 
Regards,
Bill Karwin



________________________________

        From: AmirBehzad Eslami [mailto:[EMAIL PROTECTED] 
        Sent: Thursday, July 19, 2007 5:50 PM
        To: [email protected]
        Subject: [fw-general] [ZF-General] Reading from XML file using
ConfigXML
        
        
        Hi,
        
        Suppose we have an XML file like the following one:
        
        <?xml version="1.0" encoding="UTF-8"?>
        <config>
            <production>
                <database type="mysqli"> 
                    <host>localhost</host>
                    <port>3306</port>
                    <username>root</username>
                    <password></password>
                    <dbname></dbname> 
                </database>
                <debug>TRUE</debug>
            </production>
        </config>
        
        Note that the 'database' has a 'type' attribute.
        How can I read the type attribute of database? 
        
        $config = new Zend_Config_Xml('./application/config.xml',
'production', FALSE);
        echo($config->database->sec->value);    // returns NULL
        echo($config->database->sec);    // returns NULL 
        
        Both return NULL! 
        

Reply via email to