Codeigniter 3 HMVC default_controller |
Hi,
How set $route["default_controller"] with HMVC (wiredesignz) in Codeigniter 3 ? I have this code in application/config/routes.php : Code: $route['default_controller'] = 'home'; The same code is working in Codeigniter 2.x. I add this in modules/home/config/routes.php PHP Code: <?php Please
As I remember, wiredesignz HMVC doesn't work with CI3. I may be wrong...
Website: http://avenir.ro
if you can call home/sayhello directly in your browser with the desired result
you can create a default controller in CIs controllers folder something like PHP Code: class DefaultController extends CI_Controller and in your routes php Code: $route['default_controller'] = 'DefaultController/landingpage';
In order to get HMVC running for CI you need to update some files in the third_party/mx/ folder;
there is a version of the loader class for CI 3.0 on bitbucket https://bitbucket.org/wiredesignz/codeig...s=declined And you need to change the Router.php in order to get the possibility to load modules from subdirectories and so on (01-09-2015, 03:19 AM)sintakonte Wrote: if you can call home/sayhello directly in your browser with the desired result Thankyou very much sintakonte, works but with extends MX_Controller. For this time is the one way. Thanks again.
I think it's also possible to add the following rule at the end of all the rules:
PHP Code: $route['(.*)'] = "directory/to/default/controller"; This should do the trick, but it is also necessary to implement 404 handle in the default controller if applies. Hope it works for you! Matup (01-09-2015, 03:35 AM)sintakonte Wrote: In order to get HMVC running for CI you need to update some files in the third_party/mx/ folder; I have update some files like your comments and HMVC for CI 3 works fineĀ |
Welcome Guest, Not a member yet? Register Sign In |