Zend Framework Config: Using XML File Configuration
Zend Framework Configuration Step By Step Tutorial - Part 4: This is another alternative to create a configuration file. We can store configuration data in a simple XML format. To read it, we use Zend_Config_Xml().
First, create a XML file named "config.xml" within application. Enter following code:
<?xml version="1.0"?>
<configdata>
<app>
<webhost>localhost</webhost>
<database>
<host>localhost</host>
<username>root</username>
<password>admin</password>
<dbname>zend</dbname>
</database>
</app>
</configdata>
To access it, we can use:
require_once 'Zend/Config/Xml.php';
$config = new Zend_Config_Xml('../application/config.xml','app');
| Series this article: Zend Framework Config: Using Array Configuration Zend Framework Config: Creating File Configuration Zend Framework Config: Using INI File Configuration Zend Framework Config: Using XML File Configuration blog comments powered by Disqus |

