Re: PEAR::Config misunderstanding

From: Date: Wed, 08 Feb 2006 15:02:59 +0000
Subject: Re: PEAR::Config misunderstanding
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22859@lists.php.net to get a copy of this message
Nevermind, I see what it was. The correct way to search was: $obj = &$conf->searchPath( array('Paths', array('path', array('name' => 'root')))); Nasty! Thanks, JC On 2/8/06, James Carr <james.r.carr@gmail.com> wrote: > Hi, > > I decided to try out PEAR::Config because I was really reeled in by > the claim that it supports XPath like queries to get values. To be > blunt, I was thinking I'd be able to do something like > > > require_once($config->searchPath("/Config/Packages/package[@name='adodb']")); > > which really appealed to me. However, it seems that it doesn't. :( > I've been reading through the documentation and, I just don't see how > passing an array in is "XPath like". Either way, I am confused... I > cannot for the life of me even get this to work without dumping out a > gargantuan array and looking through it like the examples show. > > Below I included my attempt to create a config file and geta value > from it. The xml outputs just fine, but search path returns false... > why!? It seems like it should return the path directive that contains > the current directory path. What gives? > > $conf =& new Config_Container('section', 'Configuration'); > $conf_paths = &$conf->createSection('Paths'); > $conf_paths->createComment('Maps out application paths to package names.'); > $conf_paths->createDirective('path', dirname(__FILE__).'/', > array('name' => 'root')); > $config = new Config(); > $config->setRoot($conf); > echo $conf->toString('xml', array('name' => 'test')); > var_dump( $conf->searchPath( array('path', array('name'=> > 'root')) ) ); > > > Thanks, > JC >

« previous php.pear.general (#22859) next »