Welcome Guest, Not a member yet? Register   Sign In
Global Array
#1

[eluser]jeremy95[/eluser]
I want to be able to user the following array through my whole CI site, for like generating dropdowns and inserting into database etc.

Code:
$ranks = array(1 => 'Admin', 2 => 'Moderator', 3 => 'User');

Where should I create the array to be able to use it in all models, views and controllers?
#2

[eluser]ecsyle31[/eluser]
Create a custom config file and autoload it. Then you can access the array through:

Code:
$this->config->item('ranks');

Your config would have:

Code:
$config['ranks'] = array(1 => 'Admin', 2 => 'Moderator', 3 => 'User');
#3

[eluser]jeremy95[/eluser]
Thanks, that helps.




Theme © iAndrew 2016 - Forum software by © MyBB