array_merge_recursive again
| From: | David T-G | Date: | Thu, 08 May 2003 10:25:42 +0000 |
| Subject: | array_merge_recursive again | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-146816@lists.php.net to get a copy of this message | ||
Hi again, all --
Thanks to Mike pointing out my huge overlooking of the obvious, I'm
tinkering with array_merge_recursive for my parsed ini files. I still
have some undesired behavior, though.
The idea is that I'll have a host-wide master ini file where I set
defaults (tools to use, colors, session name, ...), a site-wide ini file
where the client sets his defaults (name, contact numbers, tag line, ...),
and a a per-directory ini file where things can be tweaked for a special
case.
Using array_merge_recursive I am able to combine all of these things;
yay. The problem is when I have something like
host.ini:
...
listcols = 2
...
site.ini
...
listcols = 3
...
In that case, instead of stepping on the old listcols value, I suddenly
have an indexed array $listcols which points to the various values!
Maybe I do need to write my own parser because of these perhaps-special
requirements. Maybe I'm also approaching it in the wrong way, though; I
find it hard to believe that I'm the first person to need this sort of
functionality. The bottom line of what I need is:
- a cascading parameter framework giving more precedence to more
localized settings (ie the per-directory file)
- something easy enough to parse that I can build a 'settings' web
page, accept input, and rewrite the file
(at least, I think that's a complete spec ;-) Anyone have any ideas?
TIA again & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!