Welcome Guest, Not a member yet? Register   Sign In
How can I include my own global configuration file?
#1

[eluser]JREAM[/eluser]
How can I include my own global configuration file that easily accessible in every model and controller?

I'm looking for an effective solution:

1: I have a file config/setup.php that contains a multi-dimensional array of settings.
2: I currently have to include this file in a method or construct to get that array into either the controller or model.

I do not like manually including the file wherever I need it.

I currently did the following work-around:
1: index.php - Includes a Registry Pattern Class, the Setup.php file
2: I can use Registry::get('param') from anywhere in the system.

But it doesn't feel right, like I'm going out of bounds of the framework. Does anyone have any advice on how to better accomplish this?

I'm going to guess someone will suggest extending the model/controller and include the information in there -- But then I have a coupled framework, yes?
#2

[eluser]CroNiX[/eluser]
put it in the autoload in the config section?
Code:
$autoload['config'] = array('setup');
#3

[eluser]JREAM[/eluser]
Thank you sir, I appreciate your quick and easy answer, I will try this.




Theme © iAndrew 2016 - Forum software by © MyBB