Hi,
Suppose we have an XML file like the following one:
localhost
3306
root
TRUE
Note that the 'database' has a 'type' attribute.
How can I read the type attribute of database?
$config = new Zend_Config_
Sorry, the code should be like this:
$config = new Zend_Config_Xml('./application/config.xml', 'production',
FALSE);
echo($config->database->type->value);
echo($config->database->type);
These still return NULL.
Zend_Config ignores any element attributes. You'd be better off adding
mysqli
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:
lo
Thanks a lot Simon!
I'm afraid to hear that Zend_Config ignores any element attribute.
Perhaps this is because of its SimpleXML origin. I'm not certain on this.
Anyway, I come up with:
Config.xml
~~
mysqli
localhost
eral] [ZF-General] Reading from XML file using
ConfigXML
Hi,
Suppose we have an XML file like the following one:
localhost
3306
::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:* fw-general@lists.zend.com
*Subject:* [fw-general] [ZF-General] Reading f
I'm not 100% sure but I'm taking a good guess that it's the best way
to ensure functionality for the config files remains reasonable
similar. You can't, for example, specify attributes for
Zend_Config_Array nor Zend_Config_Ini without significantly altering
the way that they're structured.
egards,
Bill Karwin
From: AmirBehzad Eslami [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 19, 2007 6:33 PM
To: Bill Karwin
Cc: fw-general@lists.zend.com
Subject: Re: [fw-general] [ZF-General] Reading from XML file
using ConfigXML
o:[EMAIL PROTECTED]
Sent: Thursday, July 19, 2007 6:33 PM
To: Bill Karwin
Cc: fw-general@lists.zend.com
Subject: Re: [fw-general] [ZF-General] Reading from XML file using
ConfigXML
Bill Karwin wrote:
$db = Zend_Db::factory($config->database->type, $config->database-
>params);
I