Re: [PHP] Discussion of method -- config files

2008-06-20 Thread Eric Butera
On Thu, Jun 19, 2008 at 10:04 AM, tedd [EMAIL PROTECTED] wrote: Hi gang: More of a question of method rather than of right or wrong -- of the two methods mentioned here, which way would be better and why? 1. Setting $GLOBALS one time as shown here. At 12:23 AM -0400 6/19/08, Robert

Re: [PHP] Discussion of method -- config files

2008-06-20 Thread tedd
Hi gang: I'm not big on globals, but that may be better than including a config file every time a variable is needed. And considering that these variables are not really variables, but more of the static variety, then constants are a consideration. Thanks for all the things to consider.

[PHP] Discussion of method -- config files

2008-06-19 Thread tedd
Hi gang: More of a question of method rather than of right or wrong -- of the two methods mentioned here, which way would be better and why? 1. Setting $GLOBALS one time as shown here. At 12:23 AM -0400 6/19/08, Robert Cummings wrote: And the variables are defined in config.php

Re: [PHP] Discussion of method -- config files

2008-06-19 Thread Sancar Saran
Hi tedd My final solution was. class conf { public static $vals = array(); // config array ... } conf::$vals['mysql_host'] = 'localhost'; conf::$vals['mysql_user'] = [EMAIL PROTECTED]; you can access anywhere of your script and you won't need to pollute $GLOBALS. Regards Sancar On

Re: [PHP] Discussion of method -- config files

2008-06-19 Thread Robert Cummings
On Thu, 2008-06-19 at 10:04 -0400, tedd wrote: Hi gang: More of a question of method rather than of right or wrong -- of the two methods mentioned here, which way would be better and why? 1. Setting $GLOBALS one time as shown here. At 12:23 AM -0400 6/19/08, Robert Cummings wrote: And

Re: [PHP] Discussion of method -- config files

2008-06-19 Thread Robert Cummings
On Thu, 2008-06-19 at 17:31 +0300, Sancar Saran wrote: Hi tedd My final solution was. class conf { public static $vals = array(); // config array ... } conf::$vals['mysql_host'] = 'localhost'; conf::$vals['mysql_user'] = [EMAIL PROTECTED]; you can access anywhere of your

Re: [PHP] Discussion of method -- config files

2008-06-19 Thread Daniel Brown
My preference for years has been like so: ?php // inc/config.php # # Handles basic configuration settings. # // DATABASE SETTINGS // The name of the database. $_DB['name'] = some_database; // The user with access to the above database. $_DB['user'] = some_user; // The password for the

Re: [PHP] Discussion of method -- config files

2008-06-19 Thread Sancar Saran
Well, after reaching this $GLOBALS['live']['current']['c']['modules']['traffics']['url'] = 'blah'; I change my mind to use public static variables. using conf::$vars (or someting like that) was more pratic than using $GLOBALS directly. You can set config each of your classes. Regards

Re: [PHP] Discussion of method -- config files

2008-06-19 Thread Robert Cummings
On Thu, 2008-06-19 at 18:37 +0300, Sancar Saran wrote: Well, after reaching this $GLOBALS['live']['current']['c']['modules']['traffics']['url'] = 'blah'; I change my mind to use public static variables. using conf::$vars (or someting like that) was more pratic than using $GLOBALS

Re: [PHP] Discussion of method -- config files

2008-06-19 Thread Iv Ray
tedd wrote: Hi gang: More of a question of method rather than of right or wrong -- of the two methods mentioned here, which way would be better and why? Initially I used to access global variables using the global keyword - function foo() { global $bar; } However if the function code

Re: [PHP] Discussion of method -- config files

2008-06-19 Thread tedd
At 5:31 PM +0300 6/19/08, Sancar Saran wrote: Hi tedd My final solution was. class conf { public static $vals = array(); // config array ... } conf::$vals['mysql_host'] = 'localhost'; conf::$vals['mysql_user'] = [EMAIL PROTECTED]; you can access anywhere of your script and you