From: Martin G. <gim...@gi...> - 2002-09-14 20:22:22
|
Jeff Dairiki <da...@da...> writes: > Hey, I'd like to move the configuration data out of index.php > (again). (The little auto-decide if we really wanted to fire up main > or not code at the bottom of the current index.php is > problematic...) Having the config information in index.php was > clever when we only had one script using the info, but now it's just > a pain, and causing uneeded complexity... How about placing the configuration in two files: one file with a default configuration and one file with the users customizations. The default configuration should always be included, but the users customization is only included if the right file exists. Somethings like this: include('config/config-dist.php'); if(file_exists('config/config-user.php')) { include('config/config-user.php'); } The config-user.php file should then be ignored by CVS: I've seen conflicts when I've done 'cvs update' due to my changes in index.php. This config-user.php file should then be generated by some tool - I was very happy when I saw, that you've used the configurator.php script from PHP Weather 1.x as a basis for such a tool. Perhaps you'll like the new config tool I've made for PHP Weather 2.0. It does nice things like generating JavaScript code to check selections at the client before they're submitted and have a general system for defining dependencies between the various options which should prevent the user from making a wrong config file. You can try it out here: http://phpweather.sourceforge.net/phpweather/config/make_config.php And the source can be found here: http://cvs.sf.net/cgi-bin/viewcvs.cgi/phpweather/phpweather/config/ -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather => Shows the current weather on your webpage and PHP Shell => A telnet-connection (almost :-) in a PHP page. |