phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


Zend Framework Config: Using XML File Configuration

Tag: framework, zend, zend framework, configuration, file, xml   Category: PHP Framework
post: 21 Apr 2008 read: 365


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

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
CAPTCHA - part 3 : "Are you human or ....?" (Build Your CAPTCHA)

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting