Cannot load Model on live server |
[eluser]Richard Testani[/eluser]
I've been developing a CI site locally on my Mac and all is well, but when I went to test it out on a live server, I get an error. Code: Unable to locate the model you have specified: orders here is the code: Code: class Index extends Controller { This is only the first pat of the class The model is certainly there, and simply names Orders.php. Even when I capitalize 'Orders', no match. When I comment it out, the next model trying to load fails too. Any ideas? Thanks Rich
[eluser]Richard Testani[/eluser]
If I remove orders or swap the load order, the model fails to be located.
[eluser]jedd[/eluser]
Instead of: [quote author="Richard Testani" date="1249420553"] Code: //load models .. do this: Code: $this->load->model('Orders'); And instead of this: Quote: ... do this: Code: $data['products'] = $this->Products->getAllProducts('id'); This is covered in the CI User Guide - highly recommended reading.
[eluser]Richard Testani[/eluser]
Jedd - I did try the suggestions already and getting the same error. Libraries load fine - even my own, but for some reason it wont find the models. Code: public function index() {
[eluser]Richard Testani[/eluser]
I installed a clean version of CI on the server, added the line: Code: $this->load->model('Bsn'); The model contains nothing more than a construct and I am still getting a cannot locate model error. This is getting annoying and strange. Any ideas - much appreciated. Thanks Rich
[eluser]jedd[/eluser]
It might be time to actually show us your model code, specifically the function and constructor lines. And confirm what you have called your bsn model filename. Are you sure your web server has permissions to access the new files you're creating? What are your logs telling you?
[eluser]Richard Testani[/eluser]
Jedd. I think I found the issue which you helped lead me too. Files names were names 'Orders.php', 'Products.php' Seems, CI likes them all lowercase, or at least in this case Linux is case sensitive. Thanks for you help on this! Rich
[eluser]Richard Testani[/eluser]
I'm also realizing there is a difference between __construct() and Class_name() Seems you cant pass arguments to __construct, but the class name you can.
[eluser]wiredesignz[/eluser]
@Jedd, What are you thinking? The Codeigniter user guide specifically states all files names are lowercase except for library files which are uppercase first character only. CodeIgniter uses lowercase names for EVERYTHING internally. Class names must be uppercase first character only. The library subclass extension is an exception to this and can be specified by the developer. By default it is set to "MY_". @OP, Index is a reserved word in CodeIgniter and should not be used as a class name in any case and may be causing you some problems with the constructor running twice. |
Welcome Guest, Not a member yet? Register Sign In |