I have been trying to load some models for this website I am building. However, for an unknown reason, it will bring the following error :
An Error Was Encou
If you are on Linux then make sure your File name must match with the string passed in the load model methods the first argument.
$this->load->model('Order_Model','order_model');
You can use the second argument using that you can call methods from your model and it will work on Linux and windows as well
$result = $this->order_model->get_order_details($orderID);
In CodeIgniter 3.0-dev (get it from github) this is not working because the CI is search as first letter uppercase.
You can find the code on system/core/Loader.php line 282 or bellow:
$model = ucfirst(strtolower($model));
foreach ($this->_ci_model_paths as $mod_path)
{
if ( ! file_exists($mod_path.'models/'.$path.$model.'.php'))
{
continue;
}
require_once($mod_path.'models/'.$path.$model.'.php');
$CI->$name = new $model();
$this->_ci_models[] = $name;
return $this;
}
This mean that we need to create the file with the following name on application/models/Logon_mode.php
I experienced the same problem, but I fixed it by altering my application/config/routes.php file.
I made some restructuring to my controller directories and forget to effect it on the routes file.
Earlier:
$route['application/apply'] = 'ex/application/account/create';
and now:
$route['application/apply'] = 'application/account/create';
Make sure:
In my case I had 1 and 2 correct but forgot to name my file with .php extension. How I forgot, no idea but it sure gave me a hard time trying to figure out the problem