views:

25

answers:

1

Hey all,

I've just started to use codeigniter and I have a question.

I am using arrays for defining certain values like:

$gender = array ('male','female'); 

Or:

$maritalStatus = array ('married', 'single', 'divorced');

I am using these kind of arrays in different views. My question is, is there a chance to put all of these arrays in a configuration file and load it when I need it? Or is there another method to achieve this?

Thanks a lot.

+1  A: 

Yes, you can. Just place all your variables in an array, and save that array in a separate config file in system/application/config.

Then, in your application code, load the config file like so:

$this->config->load($config_file);

Where $config_file is the name of your config file, without the .php extension.

BoltClock
Hey BoltClock,Thank you for your answer. Now it's much more easy to orginze my code.Thanks again.
Sizofrenick