[PHP] Config files: what is best? (was: Re: [PHP] XML... Useful or another layer of complexity?)
Hello Peter, Just because you mentioned config files. What would you suggest me as better format for them? Database is not available yet since I need to make a config file before creating a database. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Peter Lind peter.e.l...@gmail.com To: Per Jessen Date created: , 10:27:09 PM Subject: [PHP] XML... Useful or another layer of complexity? Like every other technology, XML needs to have a use before it becomes a useful tool. Just using XML because it's available quickly leads to headaches, as it isn't the best tool for all scenarios (config files written in XML for instance). That said, XML is awesome for a lot of things ... however, without having a better grasp of XML you're unlikely to know whether it'll fit your needs. If for no other reason, learning XML and related technologies is worth it simply because the rest of the world uses it. So get to know it, then you'll be able to actually judge if your project can benefit from it. Regards Peter -- hype WWW: plphp.dk / plind.dk LinkedIn: plind BeWelcome/Couchsurfing: Fake51 Twitter: kafe15 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Config files
From: Hardik Doshi [EMAIL PROTECTED] I have following options for working with the configuration files with the relatively large web application. 1. Configuration variables using the DEFINE. 2. Array - Each configuration variable as an array element. 3. PHP.INI like config files. A combination of #3 and #2. Store the data in a php.ini-style config file and use parse_ini_file() to read it into an array. You could even merge the array into the $_SERVER (or any other superglobal) array so that your config vars are available in functions without having to make anything global. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Config files
Hi Group, I have following options for working with the configuration files with the relatively large web application. 1. Configuration variables using the DEFINE. 2. Array - Each configuration variable as an array element. 3. PHP.INI like config files. Please let me know which one is the best approach..Also let me know if you guys have some other good options. Please provide some references if you find it interesting for the config variables. Thanks Hardik __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Config files
I tend do do something similar here: I usually set up my arrays and then access them later using the GLOBALS superglobal array. For some projects I tend to use multidimensional arrays because I can do something like. $config['db']['name'] = 'something'; $config['db']['user'] = 'someone'; $config['db']['pass'] = 'password'; ... This can sometimes be an over kill, however that could work for you. -- BigDog On Wed, 2003-08-13 at 08:19, CPT John W. Holmes wrote: From: Hardik Doshi [EMAIL PROTECTED] I have following options for working with the configuration files with the relatively large web application. 1. Configuration variables using the DEFINE. 2. Array - Each configuration variable as an array element. 3. PHP.INI like config files. A combination of #3 and #2. Store the data in a php.ini-style config file and use parse_ini_file() to read it into an array. You could even merge the array into the $_SERVER (or any other superglobal) array so that your config vars are available in functions without having to make anything global. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Config files
I have following options for working with the configuration files with the relatively large web application. For additional reference, you might want to check out PEAR's Configuration package. It's fairly flexable and work's pretty good. Although, I have found some oddness when it's working with an XML configuration file. It works fine. Just works oddly and unintuitively. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php