Re: Suggestion: support for all types of vars in config files
| From: | Andrei Zmievski | Date: | Thu, 04 Oct 2001 15:43:13 +0000 |
| Subject: | Re: Suggestion: support for all types of vars in config files | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1600@lists.php.net to get a copy of this message | ||
On Thu, 04 Oct 2001, Hans-Peter Oeri wrote:
> Upto now, we have only string and numeric support in config files. I would
> suggest to include support for arrays (and all other types btw). Example: I
> want to have the menu structure in config files...
>
> How to do it? One possibility is to support serialized and/or wddx_serialized
> content in config files.
>
> Of course, this would include a syntax change. In order to stay as backwards
> compatible as possible, I suggest:
>
> varname = """serial:
> [serialzed content]
> """
>
> varname = """wddx:
> [wddxed content]
> """
>
> What do you think? If there's not too much negative feedback, I will provide a
> patch.
Hmm, my first reaction would be no. Config_File actually has support for
loading arrays, but in a different way. If you have multiple variables
defined with the same name and overwrite property is set to false, then
you'll get back an array instead of just one value.
foo = bar1
foo = bar2
foo = bar3
$config = new Config_File;
$config->overwrite = false;
$foo = $config->get('my.conf', null, 'foo');
// now $foo is an array of bar1, bar2, bar3
Smarty could be modified to turn off overwrite on config_load and then
syntax enhanced to allow looping through config vars...
-Andrei
"Perl - the only language that looks the same
before and after RSA encryption." -Keith Bostic