Search code examples
phpcodeignitercodeigniter-2hmvc

Codeigniter HMVC : Error on running controllers having same name from different module name


I'm using Codeigniter 2.1.3 with HMVC (https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/overview)

I've tried to run two modules in a view as shown below

<?php 
echo Modules::run('contact/mosite/contactform');  
echo Modules::run('social/mosite/facebook');  
?>

First module is running well, but second got failed to run.

If I run only second module, it will works fine.

I think the issue is on the controller name, both controller have same name.

How to fix this issue?


Solution

  • Well, if this is because of same name (I'm not sure) then I think you can use namespace and to do this you can use this patch to allow namespacing in CodeIgniter. I didn't use/test it but it works fine as other claimed.

    Important : This patch replaces the core Codeigniter.php file so be aware of that.