cvs: peardoc /en/package/configuration/config intro.xml

From: Date: Thu, 27 Nov 2003 20:07:37 +0000
Subject: cvs: peardoc /en/package/configuration/config intro.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-2015@lists.php.net to get a copy of this message
mj Thu Nov 27 15:07:37 2003 EDT Modified files: /peardoc/en/package/configuration/config intro.xml Log: * s/php/PHP/ s/xml/XML/ * Whitespace Index: peardoc/en/package/configuration/config/intro.xml diff -u peardoc/en/package/configuration/config/intro.xml:1.4 peardoc/en/package/configuration/config/intro.xml:1.5 --- peardoc/en/package/configuration/config/intro.xml:1.4 Mon Sep 8 09:03:00 2003 +++ peardoc/en/package/configuration/config/intro.xml Thu Nov 27 15:07:37 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <refentry id="package.configuration.config.intro"> <refnamediv> <refname>Introduction</refname> @@ -9,8 +9,9 @@ <refsect1> <title>Introduction</title> <para> - <classname>Config</classname> helps you manipulate your configuration whether they are stored in xml files, php arrays or other kind of datasources. -It supports these features: + <classname>Config</classname> helps you manipulate your + configuration whether they are stored in XML files, PHP arrays or + other kind of datasources. It supports these features: </para> <para> <itemizedlist> @@ -52,31 +53,29 @@ <title>An example that will create a new <classname>Config_Container</classname></title> <programlisting role="php"> <![CDATA[ +// initialize a Config_Container object - // initialize a Config_Container object +require_once('Config.php'); +$conf =& new Config_Container('section', 'conf'); +$conf_DB =& $conf->createSection('DB'); +$conf_DB->createDirective('type', 'mysql'); +$conf_DB->createDirective('host', 'localhost'); +$conf_DB->createDirective('user', 'root'); +$conf_DB->createDirective('pass', 'root'); - require_once('Config.php'); - $conf =& new Config_Container('section', 'conf'); - $conf_DB =& $conf->createSection('DB'); - $conf_DB->createDirective('type', 'mysql'); - $conf_DB->createDirective('host', 'localhost'); - $conf_DB->createDirective('user', 'root'); - $conf_DB->createDirective('pass', 'root'); +// set this container as our root container child in Config - // set this container as our root container child in Config +$config = new Config(); +$config->setRoot($conf); - $config = new Config(); - $config->setRoot($conf); - - // write the container to a php array +// write the container to a php array - $config->writeConfig('/tmp/config_test.php', 'phparray', - array('name' => 'test')); +$config->writeConfig('/tmp/config_test.php', 'phparray', + array('name' => 'test')); - // print the content of our conf section to screen +// print the content of our conf section to screen - echo $conf->toString('phparray', array('name' => 'test')); - +echo $conf->toString('phparray', array('name' => 'test')); ]]> </programlisting> </example>

« previous php.pear.doc (#2015) next »