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
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.
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
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
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
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
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
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
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
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
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
11 matches
Mail list logo