Re: XML files in PEAR packages
| From: | Tomas V.V.Cox | Date: | Tue, 29 Jun 2004 07:44:15 +0000 |
| Subject: | Re: XML files in PEAR packages | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-31316@lists.php.net to get a copy of this message | ||
Aidan Lister wrote:
Three options: 1) Provide a config file/system and document that the dir with the xml's should point to the output of "pear config-get data_dir" 2) Use the following piece of code: <?php require_once 'PEAR/Config.php'; $conf = &PEAR_Config::singleton(); $data = $conf->get('data_dir'); ?> 3) Use a replacement tag (best option): In package.xml: <file name="myscript.php"> <replace from="@pear_data@" to="data_dir" type="pear-config" /> </file> In myscript.php: $xml = fopen('@pear_data@/data.xml', 'r'); Tomas V.V.CoxYou could use the data_dir for that, by default it's in /usr/share/pear/data, so the files will not be accesible via the web-browser.People have their PEAR installs in the visible web root? How does one access files in the data-dir from within the script?