svn: /pear/peardoc/trunk/en/package/configuration/config/ avail-container/php-constants.xml examples/php-constants-write.php
examples/php-constants-write.txt

From: Date: Thu, 10 Mar 2011 18:09:45 +0000
Subject: svn: /pear/peardoc/trunk/en/package/configuration/config/ avail-container/php-constants.xml examples/php-constants-write.php
examples/php-constants-write.txt
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-12066@lists.php.net to get a copy of this message
cweiske Thu, 10 Mar 2011 18:09:45 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=309076 Log: config PHPConstants container example Changed paths: U pear/peardoc/trunk/en/package/configuration/config/avail-container/php-constants.xml A pear/peardoc/trunk/en/package/configuration/config/examples/php-constants-write.php A pear/peardoc/trunk/en/package/configuration/config/examples/php-constants-write.txt Modified: pear/peardoc/trunk/en/package/configuration/config/avail-container/php-constants.xml =================================================================== --- pear/peardoc/trunk/en/package/configuration/config/avail-container/php-constants.xml 2011-03-10 17:00:03 UTC (rev 309075) +++ pear/peardoc/trunk/en/package/configuration/config/avail-container/php-constants.xml 2011-03-10 18:09:45 UTC (rev 309076) @@ -15,5 +15,31 @@ lost. There are no options for this container. </para> - <!-- FIXME: example file, example load, example save --> + + <section> + <info> + <title>Writing a PHPConstants config file</title> + </info> + + <programlisting role="php"> + <xi:include parse="text" + xmlns:xi="http://www.w3.org/2001/XInclude" + href="&package.configuration.config.examples.php-constants-write.php;" + > + <xi:fallback>FIXME:MISSING XINCLUDE CONTENT</xi:fallback> + </xi:include> + </programlisting> + + <example> + <title>Generated file</title> + <programlisting role="php"> + <xi:include parse="text" + xmlns:xi="http://www.w3.org/2001/XInclude" + href="&package.configuration.config.examples.php-constants-write.txt;" + > + <xi:fallback>FIXME:MISSING XINCLUDE CONTENT</xi:fallback> + </xi:include> + </programlisting> + </example> + </section> </section> Added: pear/peardoc/trunk/en/package/configuration/config/examples/php-constants-write.php =================================================================== --- pear/peardoc/trunk/en/package/configuration/config/examples/php-constants-write.php (rev 0) +++ pear/peardoc/trunk/en/package/configuration/config/examples/php-constants-write.php 2011-03-10 18:09:45 UTC (rev 309076) @@ -0,0 +1,20 @@ +<?php +require_once 'Config.php'; + +$conf = new Config(); +$root = $conf->getRoot(); +$root->createComment('Demo config file with PHPArray container'); +$root->createDirective('openLastFile', true); + +$root->createBlank(); +//PHPConstants container does not support sections but puts them in the main +// namespace +$dbsect = $root->createSection('database'); +$dbsect->createDirective('host', 'db-server.example.org'); +$dbsect->createDirective('name', 'demo-db'); + +$r = $conf->writeConfig('php-constants-write.txt', 'phpconstants'); +if (PEAR::isError($r)) { + echo $r->getMessage() . "\n"; +} +?> \ No newline at end of file Added: pear/peardoc/trunk/en/package/configuration/config/examples/php-constants-write.txt =================================================================== --- pear/peardoc/trunk/en/package/configuration/config/examples/php-constants-write.txt (rev 0) +++ pear/peardoc/trunk/en/package/configuration/config/examples/php-constants-write.txt 2011-03-10 18:09:45 UTC (rev 309076) @@ -0,0 +1,18 @@ +<?php + +/** + * + * AUTOMATICALLY GENERATED CODE - DO NOT EDIT BY HAND + * +**/ +// Demo config file with PHPArray container +define('OPENLASTFILE', true); + + +// +// database +// +define('HOST', 'db-server.example.org'); +define('NAME', 'demo-db'); + +?> \ No newline at end of file

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