codeigniter+HMVC cross module call controller->method codeigniter+HMVC cross module call controller->method codeigniter codeigniter

codeigniter+HMVC cross module call controller->method


Thanks for MC's tip, I finally figured out the cause. HMVC doc indeed lacks some examples for beginner.

For anyone who may find this thread in the future, correct usage here:

to call module01/controller01/method00://method 1 CORRECT:$ctlObj = modules::load('module01/controller01/');$ctlObj->method00();//or you could use chaining:modules::load('module01/controller01/')->method00();//method 1 WRONG:modules::load('module01/controller01/method00');  //this will only load contructor---//method 2 CORRECT:modules::run('module01/controller01/method00');   //no trailing slash!//method 2 WRONG:modules::run('module01/controller01/method00/');  ---//method 3 CORRECT:$this->load->module('module01/controller01');$this->controller01->method00();

I don't understand why method 3 failed when I first try... maybe because I restarted HTTPD?


This HMVC works well for me. I'm working on a project using this HMVC now.Just edit third_party/MX/Modules.php as shown in this link below and tell me the response.

https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/pull-request/5/return-error-messages-instead-of-logging/diff


I ran into the same issue. Make sure you check capitalization of your directories and and controllers. It's not case sensitive for differing between the module and controller name.

//In my case the below did not work$this->load->module('dashboard/Dashboard');$this->Dashboard->method();//but $this->load->module('dashboard');$this->Dashboard->method();//worked