Re: Config class
| From: | Chuck Hagenbuch | Date: | Thu, 25 Jul 2002 18:56:43 +0000 |
| Subject: | Re: Config class | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-8000@lists.php.net to get a copy of this message | ||
Quoting Bertrand Mansion <bmansion@mamasam.com>:
> This I can do easily with QuickForm and a small xml parser.
I've looked at the various forms stuff in PEAR before, and I might have
missed something or it might be a while since I looked, but I haven't found
anything that's less tied to HTML and lets you create forms which really
handles themselves and their validation nicely. The FormSprocket:: lib, what
I've been working on in Horde, provides all of this, with configurable
rendererers, etc.
> What does your conf.php file looks like ? xml, php .ini, properties,
> apache-like conf or just standard php code ?
Here's an example of the XML:
http://cvs.horde.org/co.php/hermes/config/conf.xml
The generated config file looks like this:
<?php
$conf['storage']['driver'] = 'sql';
$conf['storage']['params']['phptype'] = 'mysql';
$conf['storage']['params']['hostspec'] = 'localhost';
$conf['storage']['params']['username'] = 'horde';
$conf['storage']['params']['password'] = 'hordepass';
$conf['storage']['params']['database'] = '***';
$conf['menu']['apps'] = array('imp', 'turba');
?>
Just simple PHP - something that's easy to use in an app. I don't want my
applications parsing an XML file or even a text .ini file every page load,
when really the only thing that you need the extra information for is the
configuration system.
I don't see a reason to handle any style of config file; for what I need,
you want something that a nice config UI can be generated from - and XML is
perfect, since it provides all of the metadata - and then a parsed config
that I can use in my app with as little overhead as possible.
I'm also not concerned about modifying the .xml file, since the application
developer can easily do that with a text editor, and then those changes are
automatically propogated to those using the config tool.
> I made some tests with htdig.conf, resolv.conf, man.conf, php.ini (these
> are the config files installed on my machine) and it seems to work, I just
> need to change the comments, delimiter and follow tags to adapt to the
> different format. htdig uses ':' and '#', php uses '=' and
> ';'...
A generic config parser like this is a rather different project than a
system to handle configuration for newly defined apps, IMHO.
> You might also want to help me with the Config class in order to make it
> work with your conf.php file.
It really sounds to me like you're working on a seperate idea.
-chuck
--
Charles Hagenbuch, <chuck@horde.org>
"After a few minutes the most aromatic and nice smelling Italian coffee
will come out of the exhaustpipe." - Our stove-top espresso pot