• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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, 05:02 AM
HMVC and Admin - by El Forum - 03-03-2012, 07:40 AM
HMVC and Admin - by El Forum - 03-03-2012, 09:32 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.