[prev in list] [next in list] [prev in thread] [next in thread]
List: pear-doc
Subject: [PEAR-DOC] cvs: peardoc /en/package/configuration/config intro.xml
From: "Christophe Gesché" <moosh () php ! net>
Date: 2006-02-22 19:20:58
Message-ID: cvsmoosh1140636058 () cvsserver
[Download RAW message or body]
moosh Wed Feb 22 19:20:58 2006 UTC
Modified files:
/peardoc/en/package/configuration/config intro.xml
Log:
add more external ressources
["moosh-20060222192058.txt" (text/plain)]
http://cvs.php.net/viewcvs.cgi/peardoc/en/package/configuration/config/intro.xml?r1=1.8&r2=1.9&diff_format=u
Index: peardoc/en/package/configuration/config/intro.xml
diff -u peardoc/en/package/configuration/config/intro.xml:1.8 \
peardoc/en/package/configuration/config/intro.xml:1.9
--- peardoc/en/package/configuration/config/intro.xml:1.8 Mon Apr 11 14:26:28 2005
+++ peardoc/en/package/configuration/config/intro.xml Wed Feb 22 19:20:58 2006
@@ -1,58 +1,73 @@
-<!-- $Revision: 1.8 $ -->
+<!-- $Revision: 1.9 $ -->
<refentry id="package.configuration.config.intro">
- <refnamediv>
- <refname>Introduction</refname>
- <refpurpose>
- What Config can do
- </refpurpose>
- </refnamediv>
- <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:
- </para>
- <para>
- <itemizedlist>
- <listitem>
- <simpara>Parse different configuration formats.</simpara>
- </listitem>
- <listitem>
- <simpara>Manipulate sections, directives, comments, blanks the way you \
want.</simpara>
- </listitem>
- <listitem>
- <simpara>Write them back to a datasource in your preferred \
format.</simpara>
- </listitem>
- </itemizedlist>
- </para>
- <para>
- The <classname>Config</classname> object acts as a container for other \
<classname>Config_Container</classname> objects. It doesn't do much but makes \
handling IO operations easier. It contains the root \
<classname>Config_Container</classname> object which in turn contains a child \
<classname>Config_Container</classname> object. \
<classname>Config_Container</classname> objects store references to their parent and \
have an array of children. This structure makes it easy to access the different \
containers and their contents.
- </para>
- <para>
- A <classname>Config_Container</classname> object can be of different type:
- <itemizedlist>
- <listitem>
- <simpara>Section: a section contains other \
<classname>Config_Container</classname> objects.</simpara>
- </listitem>
- <listitem>
- <simpara>Directive: a directive does not contain any other object but \
has content and a name. See them as key-value pairs.</simpara>
- </listitem>
- <listitem>
- <simpara>Comment: just like directives, comments have content but they \
don't have a name. They are rendered in a special way according to the configuration \
type you choosed.</simpara>
- </listitem>
- <listitem>
- <simpara>Blank: they don't have neither content or name but are used to \
indicate blank lines if your renderer uses them.</simpara>
- </listitem>
- </itemizedlist>
- </para>
- <para>
- When using the <classname>Config</classname> package, most of the work is \
done with <classname>Config_Container</classname> objects.
- </para>
- <example>
- <title>An example that will create a new \
<classname>Config_Container</classname></title>
- <programlisting role="php">
- <![CDATA[
+ <refnamediv>
+ <refname>Introduction</refname>
+ <refpurpose>
+ What Config can do
+ </refpurpose>
+ </refnamediv>
+ <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:
+ </para>
+ <para>
+ <itemizedlist>
+ <listitem>
+ <simpara>Parse different configuration formats.</simpara>
+ </listitem>
+ <listitem>
+ <simpara>Manipulate sections, directives, comments, blanks the way you \
want.</simpara> + </listitem>
+ <listitem>
+ <simpara>Write them back to a datasource in your preferred format.</simpara>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ The <classname>Config</classname> object acts as a container
+ for other <classname>Config_Container</classname> objects.
+
+ It doesn't do much but makes handling IO operations easier.
+
+ It contains the root <classname>Config_Container</classname> object which in
+ turn contains a child <classname>Config_Container</classname> object.
+
+ <classname>Config_Container</classname> objects store references to their
+ parent and have an array of children.
+
+ This structure makes it easy to access the different
+ containers and their contents.
+ </para>
+ <para>
+ A <classname>Config_Container</classname> object can be of different type:
+ <itemizedlist>
+ <listitem>
+ <simpara>Section: a section contains other \
<classname>Config_Container</classname> objects.</simpara> + </listitem>
+ <listitem>
+ <simpara>Directive: a directive does not contain any other object but has \
content and a name. See them as key-value pairs.</simpara> + </listitem>
+ <listitem>
+ <simpara>Comment: just like directives, comments have content but they don't \
have a name. They are rendered in a special way according to the configuration type \
you choosed.</simpara> + </listitem>
+ <listitem>
+ <simpara>Blank: they don't have neither content or name but are used to \
indicate blank lines if your renderer uses them.</simpara> + </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ When using the <classname>Config</classname> package,
+ most of the work is done with <classname>Config_Container</classname> objects.
+ </para>
+ <example>
+ <title>An example that will create a new \
<classname>Config_Container</classname></title> + <programlisting role="php">
+ <![CDATA[
// initialize a Config_Container object
require_once('Config.php');
@@ -77,15 +92,22 @@
echo $conf->toString('phparray', array('name' => 'test'));
]]>
- </programlisting>
- </example>
- <para>
- The above example illustrates how <classname>Config</classname> and \
<classname>Config_Container</classname> can interact. There are other ways. You could \
have for example first created the Config object and then used <link \
linkend="package.configuration.config.config.getroot"><function>$config->getRoot</function></link> \
to add sections and directives to the returned object reference.
- </para>
- <example>
- <title>Reading configuration from an XML file</title>
- <programlisting role="php">
- <![CDATA[
+ </programlisting>
+ </example>
+ <para>
+ The above example illustrates how <classname>Config</classname>
+ and <classname>Config_Container</classname> can interact.
+
+ There are other ways.
+
+ You could have for example first created the Config object and then used
+ <link linkend="package.configuration.config.config.getroot"><function>$config->getRoot</function></link> \
+ to add sections and directives to the returned object reference.
+ </para>
+ <example>
+ <title>Reading configuration from an XML file</title>
+ <programlisting role="php">
+ <![CDATA[
require_once 'Config.php';
$conf = new Config;
@@ -103,13 +125,13 @@
$settings['root']['conf']['lastname']
);
]]>
- </programlisting>
- <para>
- In this example the XML file <filename>config.xml</filename>
- looks like this:
- </para>
- <programlisting role="xml">
- <![CDATA[
+ </programlisting>
+ <para>
+ In this example the XML file <filename>config.xml</filename>
+ looks like this:
+ </para>
+ <programlisting role="xml">
+ <![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<conf>
@@ -118,12 +140,21 @@
<www>http://example.com/</www>
</conf>
- ]]>
- </programlisting>
- </example>
- <para>For more information, DevShed has a great <ulink \
url="http://www.devshed.com/c/a/PHP/Configuration-Manipulation-With-PHP-Config/">tutorial</ulink> \
about the Config package.</para>
- </refsect1>
- </refentry>
+ ]]>
+ </programlisting>
+ </example>
+ <para>
+ For more information,
+ You can read
+ <ulink url="http://pear.php.net/package/Config/docs">API doc</ulink>,
+ <ulink url="http://cvs.php.net/cvs.php/pear/Config/docs">sample of \
package</ulink>, + <ulink url="http://cvs.php.net/cvs.php/pear/Config/test">tests \
of package</ulink>, + and a great
+ <ulink url="http://www.devshed.com/c/a/PHP/Configuration-Manipulation-With-PHP-Config/">tutorial</ulink> \
+ of DevShed about the Config package.
+ </para>
+ </refsect1>
+</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
--
PEAR Documentation List Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic