Models in 3.0.6 |
Hi,
I've been using CI for a number of years. I'm upgrading all my sites to 3.0.6 and having problems with models. Quote:Unable to locate the model you have specified: Blog I'm even getting this message with the tutorial model The model file name is blog_model.php It is a copy of the "What is a Model" code from the tutorial. It is being called from the Welcome controller with Code: public function test() Can someone confirm that 3.0.6 models are okay and/or point out where/if I am having one of those "moments"
Wirh CI3, your class filenames (models, controllers & libraries) need to be UCfirst.
i.e. Blog_model instead of blog_model. You would still load it with $this->load->model('blog_model'); (04-27-2016, 01:37 AM)ciadmin Wrote: Wirh CI3, your class filenames (models, controllers & libraries) need to be UCfirst. Hi ciadmin, Thanks for the reply. I am using UCfirst e.g. PHP Code: class Blog_model extends CI_Model { Best regards, Paul.
What he is saying is that the models need to saved with UCFirst.
Blog_model.php What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(04-27-2016, 04:40 AM)InsiteFX Wrote: What he is saying is that the models need to saved with UCFirst. Hi InsiteFX, I've tried quite a few combinations of file names, class names and caller naming. Blog_model.php still results in :- Quote:An uncaught Exception was encountered As it's only 3 files (including routes.php) would someone create a simple test with 3.0.6 and post the files here?
If the model is named "Blog_model.php", then load it like this:
$this->load->model('blog_model'); So include the _model part, not just "blog". And when you call a method that's part of the model, type this: $this->blog_model->method_name(); (04-27-2016, 05:54 AM)Wouter60 Wrote: If the model is named "Blog_model.php", then load it like this: Thank you Wouter60 and everyone else for your help. I knew it was me - I just couldn't see the trees from the woods. |
Welcome Guest, Not a member yet? Register Sign In |