Welcome Guest, Not a member yet? Register   Sign In
Autoload a model in another autoload page
#1

[eluser]dorwin[/eluser]
Hello,

I see I can load a model and give it a different name, such as :

Code:
$this->load->model('model_login', 'log');

with 'log' as name, to use $this->log->myfunction()...

But if I put this model in autoload page, I cant do that !

I would like to know where put my line below to have my model with this name on all my pages, main controller I suppose but.. where it is ? Maybe I can put it in a more appropriate location ?

Thanks !
#2

[eluser]jedd[/eluser]
You can either rename your model (this would be my preference - having a model named what you want it to be named seems the least convoluted approach).

Or you can load it in the constructor to MY_Controller .. I'd guess that would work as you intend. It kind of mungs up the intent of both the autoload and the MY_Controller extension IMO.
#3

[eluser]dorwin[/eluser]
Yeah it's true, I could rename my model.. I just like well orderly files, views with "view_" as prefixe, and same for model.. I'll consider it, thanks for the answer Smile




Theme © iAndrew 2016 - Forum software by © MyBB