Re: Can someone please point me to a valid example of how to use the Config pkg?
| From: | Matte Edens | Date: | Wed, 25 Aug 2004 18:15:22 +0000 |
| Subject: | Re: Can someone please point me to a valid example of how to use the Config pkg? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14293@lists.php.net to get a copy of this message | ||
I've been using Config but only for reading values. I haven't been editing them. That being said, I'm using it with the array structure. I just named my config array "conf" and it worked. Sample array is here...
$conf = array(
'toolkitdir' => 'd:/projects/toolkit/php/',
'mysql' => array(
'user' => 'foo',
'password' => 'bar',
'host' => 'localhost',
'database' => 'db'
)
);
I've never created the array the way that Evan did. Separate lines.
matte - matte@arubanetworks.com
webmonkey / arubanetworks.com / airheads04.com / wi-fi-it.com
Kushmit Indurain wrote:
Thanks Evan for the info :) But that seems incredible... so Config can handle Windows-style INI files (which have been pretty much deprecated in favor of the registry), and XML files (used only sparingly in the real world for config data). But the most common format for PHP config files can't be handled by Config?!!?! Amazing. Oh well. I guess I will have to start putting something together using parse_ini_file. Thanks again, -K --- Evan Broder <ebroder@ebroder.net> wrote:The type of config file you described will not work with Config because the config entries need to be part of an array. aka $settings["var1"] = "blah"; $settings["var2"] = "blahblah"; etc... Evan Broder