CodeIgniter Forums
Model Autoload - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Model Autoload (/showthread.php?tid=77092)



Model Autoload - vinothkanth - 07-18-2020

why load models without autoload or call load..in the view


RE: Model Autoload - InsiteFX - 07-19-2020

There is a global helper method for just that.

PHP Code:
$model model('your_model_name'); 

SEE: CodeIgniter 4 User Guide - Global Functions and Constants


RE: Model Autoload - vinothkanth - 07-28-2020

Thank you for your answer. ..I dont want any models to load in the view.

I mean....$this->citizen_model->somefunction(); I call this on the view..but I am not load the citizen model in the view...but the function return values...why?..it is a bug on codeigniter?


RE: Model Autoload - jreklund - 08-01-2020

I guess you are using CodeIgniter 3 based on your last reply.

You can't remove that, it will always be accessible. You need to re-write how CodeIgniter works to get rid of that, it's not a bug. It's a "feature".