Welcome Guest, Not a member yet? Register   Sign In
HMVC: Routing issue
#7

[eluser]qpixo[/eluser]
[quote author="weboap" date="1337278574"]the modules routes
Code:
$route['^(?!module2|module3).*'] = "module1/$0";
$route['module2/(:any)'] = "module2/$1";
$route['module3/(:any)'] = "module3/$1";

should be before that the system get to the modules, if you get what mean so that part need to be in the main
/config/routes
like:

Code:
[code]
$route['^(?!site|backend|....).*'] = "login/$0";
$route['site/(:any)'] = "site/$1";
$route['backend/(:any)'] = "backend/$1";

Note: i'm here just applying your structure.

what i think it should be like is :

Code:
$route['^(?!login|backend|....).*'] = "site/$0";
$route['login/(:any)'] = "login/$1";
$route['backend/(:any)'] = "backend/$1";



Code:
$route['login'] = "login/index";  // not needed

not needed as in you module local route

login been the module and the index your default controller
/application/modules/module1/config/routes.php
Code:
$route['default_controller'] = "index";

doing it this way you can get access to the controllers under site as
http://www.site.com/controllers_name


controllers under login module or backend module will be

http://www.site.com/login/controllers_name

http://www.site.com/backend/controllers_name



hope it help.
note the way you are doing it now
to access the contact controller will be like
http://www.site.com/site/contact

hope it help


[/quote]

I'm a bit confused about your example, I have the default application/config/routes.php file and two others routes files in modules directory (application/login/config/routes.php and application/site/config/routes.php) Where on each routes file should I add those lines?

My current default application/config/routes.php contains
Code:
$route['default_controller'] = "site";

What I'd like to do is when user typing:
http://www.site.com/login It will load in login form

http://www.site.com/ and, or http://www.site.com/contact It will load in public normal site



Messages In This Thread
HMVC: Routing issue - by El Forum - 05-16-2012, 01:25 PM
HMVC: Routing issue - by El Forum - 05-16-2012, 02:38 PM
HMVC: Routing issue - by El Forum - 05-17-2012, 08:22 AM
HMVC: Routing issue - by El Forum - 05-17-2012, 09:38 AM
HMVC: Routing issue - by El Forum - 05-17-2012, 10:59 AM
HMVC: Routing issue - by El Forum - 05-17-2012, 11:16 AM
HMVC: Routing issue - by El Forum - 05-17-2012, 11:45 AM
HMVC: Routing issue - by El Forum - 05-17-2012, 11:55 AM
HMVC: Routing issue - by El Forum - 05-17-2012, 12:00 PM
HMVC: Routing issue - by El Forum - 05-17-2012, 12:07 PM
HMVC: Routing issue - by El Forum - 05-22-2012, 10:32 AM
HMVC: Routing issue - by El Forum - 05-22-2012, 10:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB