Zend_Config ignores any element attributes. You'd be better off adding
<type>mysqli</type>
and then passing it across like:-
$db = Zend_Db::factory($config->database->type, $config->database-
>toArray());
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!
--
Simon Mundy | Director | PEPTOLAB
""" " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654
4124
http://www.peptolab.com