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. Che

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,

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 won

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 functi

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 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 Sancar

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

2008-06-19 Thread Daniel Brown
My preference for years has been like so: Then, in a general file, I include all files that will need to be included across all pages like so: And without writing out all files, as I'm sure your imagination should suffice, I'll show the database basics. First, in an include fil

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 an

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 Cumming

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 O

[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 --