views:

2067

answers:

1

I'm new to code igniter.

I want to declare some global variables and global constants. Normally, I would put them in the includes/global.php of my own custom framework.

Where should I define globals in Code Igniter? Here's an example of the globals I want to declare:

define('USERSTAT_OFFLINE', 0);
define('USERSTAT_ONLINE', 1);
define('USERSTAT_AWAY', 2);
define('USERSTAT_BUSY', 3);

$PAYMENT_PLANS = array();
$PAYMENT_PLANS[] = array('id'=>1, 'name'=>'Trial');
$PAYMENT_PLANS[] = array('id'=>2, 'name'=>'Premium Plan');
+6  A: 

You may utilise config file (system/application/config/config.php) to set configuration related variables.

Or use constant file (system/application/config/constants.php) to store site preference constants.

rockacola
constants.php is good for the constants, but i don't think config.php is appropriate for global variables, because config.php, by it's name is for configuration settings, not for global variables.
Obay