I want to use The Modular Extensions HMVC in my Project like this:
modules
module01
models
models01.php
contr
add module name followed by model name, make sure every word is in small. I resolved my issue by using this piece of code.
$this->load->model('settings/settings_model','settings_model');
$this->load->model("module01/models01");
You can call any models from any module like this. Tested.
In my case using $this->load->model("module01/models01");
not worked,
But after debugging for couple of hours i have found the solution which is as below, i will explain it using the same example as Questioner:
So the solution not working in my case because i have module name as Module01
(first letter was capital in my directory name) and even if i use the same while loading model like $this->load->model("Module01/models01");
it wasn't working.
Then after trying lots of different cases i have found the solution that worked and want to share some of the rule which we have to follow if we are working in hmvc in codeigniter and loading multiple models in one controller which are as follows:
Names of the Directories in modules
folder must be in lowercase (should be like module01
not .)Module01
The 1st letter of the controller and model files name have to be the uppercase like Module01 and Models01
(see below example).
The 1st letter of the class name of the controller and model must be in uppercase like
// module01/Module01.php
class Module01 extends MX_Controller {
//some code
}
// module01/Models01.php
class Models01 extends CI_Model {
//some code
}