Welcome Guest, Not a member yet? Register   Sign In
HMVC and Admin
#2

[eluser]PhilTem[/eluser]
HMVC supports routing for a module separately from the application-wide routing. As the wiki on bitbucket says

Quote:Each module may contain a config/routes.php file where routing and a default controller can be defined for that module using:
$route[‘module_name’] = ‘controller_name’;

Here's my approach from another recent project:

./application/config/routes.php
Code:
$route['admin/(:any)/(:any)'] = '$1/admin/$2';
$route['admin/(:any)'] = '$1/admin/index';

./application/modules/<module>/config/routes.php
Code:
$route['admin/photo/tags/(:any)'] = 'photo/admin_tags/$2';
$route['admin/photo/tags'] = 'photo/admin_tags/index';
$route['admin/photo/categories/(:any)'] = 'photo/admin_categories/$2';
$route['admin/photo/categories'] = 'photo/admin_categories/index';

I'm not 100% sure whether this works this way - I had the second part put directly into ./application/config/routes.php. And always remember for routes: first come first serve.


Messages In This Thread
HMVC and Admin - by El Forum - 03-03-2012, 04:02 AM
HMVC and Admin - by El Forum - 03-03-2012, 06:40 AM
HMVC and Admin - by El Forum - 03-03-2012, 08:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB