CodeIgniter Forums
Autoloading helpers, models in config vs loading it in controller? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Autoloading helpers, models in config vs loading it in controller? (/showthread.php?tid=51340)



Autoloading helpers, models in config vs loading it in controller? - El Forum - 04-30-2012

[eluser]Michal1[/eluser]
Hello guys,

every code example I see does load its models, helpers and stuff like that in the controller function.

For example

Code:
function Test()  
    {  
        parent::Controller();  
        $this->load->model('test_model');  
  
    }

While I do all this stuff in config folder and autoloading that. Is this bad approach? If I understand it correctly the only reason why to load it only in certain controller is a speed right?


Autoloading helpers, models in config vs loading it in controller? - El Forum - 04-30-2012

[eluser]Stefan Hueg[/eluser]
Speed and memory consumption, yes. CodeIgniters approach, compared to other frameworks, is: Load as few files as possible.

That's the secret ingredient why I choose CodeIgniter among all others Smile