|
@@ -1,5 +1,5 @@
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
-<!-- EN-Revision: 15998 -->
|
|
|
|
|
|
|
+<!-- EN-Revision: 16945 -->
|
|
|
<!-- Reviewed: no -->
|
|
<!-- Reviewed: no -->
|
|
|
<sect1 id="zend.config.adapters.xml">
|
|
<sect1 id="zend.config.adapters.xml">
|
|
|
<title>Zend_Config_Xml</title>
|
|
<title>Zend_Config_Xml</title>
|
|
@@ -188,4 +188,55 @@ EOT;
|
|
|
$config = new Zend_Config_Xml($string, 'staging');
|
|
$config = new Zend_Config_Xml($string, 'staging');
|
|
|
]]></programlisting>
|
|
]]></programlisting>
|
|
|
</note>
|
|
</note>
|
|
|
|
|
+
|
|
|
|
|
+ <note>
|
|
|
|
|
+ <title>Espace de noms XML de Zend_Config</title>
|
|
|
|
|
+
|
|
|
|
|
+ <para>
|
|
|
|
|
+ <classname>Zend_Config</classname> possède son propre espace de noms, qui ajoute
|
|
|
|
|
+ des fonctionnalités additionnelles lors du processus d'analyse. Pour tirer avantage
|
|
|
|
|
+ de celui-ci, vous devez définir l'espace de noms avec l'<acronym>URI</acronym>
|
|
|
|
|
+ <filename>http://framework.zend.com/xml/zend-config-xml/1.0/</filename> dans
|
|
|
|
|
+ votre noeud racine de configuration.
|
|
|
|
|
+ </para>
|
|
|
|
|
+
|
|
|
|
|
+ <para>
|
|
|
|
|
+ Avec l'espace de noms activé, vous pouvez maintenant utiliser les constantes
|
|
|
|
|
+ <acronym>PHP</acronym> à l'intérieur de vos fichiers de configuration.
|
|
|
|
|
+ De plus l'attribut <emphasis>extends</emphasis> a été déplacé dans ce nouvel
|
|
|
|
|
+ espace de noms et déprécié de l'espace de noms <constant>NULL</constant>.
|
|
|
|
|
+ Il en sera complétement effacé dans Zend Framework 2.0.
|
|
|
|
|
+ </para>
|
|
|
|
|
+
|
|
|
|
|
+ <programlisting language="xml"><![CDATA[
|
|
|
|
|
+$string = <<<EOT
|
|
|
|
|
+<?xml version="1.0"?>
|
|
|
|
|
+<config xmlns:zf="http://framework.zend.com/xml/zend-config-xml/1.0/">
|
|
|
|
|
+ <production>
|
|
|
|
|
+ <includePath>
|
|
|
|
|
+ <zf:const zf:name="APPLICATION_PATH"/>/library</includePath>
|
|
|
|
|
+ <db>
|
|
|
|
|
+ <adapter value="pdo_mysql"/>
|
|
|
|
|
+ <params>
|
|
|
|
|
+ <host value="db.example.com"/>
|
|
|
|
|
+ </params>
|
|
|
|
|
+ </db>
|
|
|
|
|
+ </production>
|
|
|
|
|
+ <staging zf:extends="production">
|
|
|
|
|
+ <db>
|
|
|
|
|
+ <params>
|
|
|
|
|
+ <host value="dev.example.com"/>
|
|
|
|
|
+ </params>
|
|
|
|
|
+ </db>
|
|
|
|
|
+ </staging>
|
|
|
|
|
+</config>
|
|
|
|
|
+EOT;
|
|
|
|
|
+
|
|
|
|
|
+define('APPLICATION_PATH', dirname(__FILE__));
|
|
|
|
|
+$config = new Zend_Config_Xml($string, 'staging');
|
|
|
|
|
+
|
|
|
|
|
+echo $config->includePath; // Affiche "/var/www/something/library"
|
|
|
|
|
+]]></programlisting>
|
|
|
|
|
+ </note>
|
|
|
|
|
+
|
|
|
</sect1>
|
|
</sect1>
|