CodeIgniter Forums
HMVC - different module with same controler name - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: HMVC - different module with same controler name (/showthread.php?tid=57219)



HMVC - different module with same controler name - El Forum - 02-27-2013

[eluser]Unknown[/eluser]
so lets say i have 2 modules like this
Code:
/application
    /modules
        /moduleA
            /controllers
                default_controller.php
            /models
            /views
        /moduleB
            /controllers
                default_controller.php
            /models
            /views

on each module, i need default controller to assume it as the main controller but i dont want name it like module name, so i always create default_controller.php in controller as the main controller.

and now the problem lead to when i going to call each main controller from modules, let say something like this

Code:
<?php
echo Modules::run('moduleA/default_controller/index');
echo Modules::run('moduleB/default_controller/index');
?>

and the results are there are 2 output from moduleA. in my opinion, i cant load two or more modules at the same time with same controller/class name because it will lead us to the firs module we call. and for note i already extends MX_Controller on each controller.

any idea about this?


HMVC - different module with same controler name - El Forum - 02-27-2013

[eluser]InsiteFX[/eluser]
A Controller is a class and no two classes in php can have the same name, you need to change the name of one of your Controllers.