Welcome Guest, Not a member yet? Register   Sign In
Best place for loading web app settings from database
#4

(This post was last modified: 01-26-2016, 09:38 AM by keulu.)

Hi scion,

I did that for a project one day.

I created a config_model, and extended the CI_Controller with my own controller (in the core folder C.F. MY_Controller)

see http://www.codeigniter.com/user_guide/ge...asses.html

PHP Code:
class MY_Controller extends CI_Controller {

        protected 
$config;
        public function 
__construct()
        {
                
parent::__construct();
                
// load your config_model
                
$config $this->config_model->getConfig();
        }


after that, $config can be accessible by a $this->config if your controller extend MY_Controller and not CI_Controller

i'm agree with josepostiga. "DON'T TOUCH THE SYSTEM'S FOLDER !!!!!" Smile
Reply


Messages In This Thread
RE: Best place for loading web app settings from database - by keulu - 01-26-2016, 09:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB