Saturday 24 May 2014

Loading a controller from another module in CodeIgniter HMVC Wiredesign

It seems that the module can be loaded without specifying the controller name only if the controller name matches the module name :

Controllers can be loaded as class variables of other controllers using $this->load->module('module/controller'); or simply $this->load->module('module'); if the controller name matches the module name

Try to load the module like that :

//if controller name matches the module name
$this->load->module('name_module'); 
$this->name_module->name_method();
//if controller name not matches the module name
$this->load->module('name_module'/'name_controller');
$this->name_controller->name_method();

No comments:

Berikan Komentar