• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Routing and Remap

#1
[eluser]JanDoToDo[/eluser]
Hey guys,
I'm building a CMS with a Public_Controller and an Admin_Controller both extended from MY_Controller. I have a few controllers which are public facing that serve different functions which is why i made them different controllers, e.g. users, auth, pages etc and each of these are childs of Public_Controller. This is similar to the situation i have with my Admin controllers.

My questions is, I route using the routing rules to the specified controller required, but im wondering if it is better to just route to the particular function you need in the controller or, use the _remap method in the controller to remap the request? I'm wondering because, if the URI is say "users/edit/profile/3" then the routing rules know to route this to users instead of say pages or auth and go to the right place, but does the remap function also keep the subsequest uri segments in the request? I guess using remap is better because then i could go to a function depending on a setting in the database or someting which i couldnt do in the routing rules?

Is this the best way to go about it? My current routing rules are:

Code:
$route['admin/(:any)'] = 'admin/$1';
$route['admin'] = 'admin/pages';

$route['auth/(:any)'] = 'auth/$1';
$route['auth'] = 'auth/index';
$route['(:any)'] = "page";

Do these seem right?! Will the (:any) in the rules take account of multiple sub sections? like admin/create/user/profile/2? If a method isnt in the remap function but gets called will it just run its default route, i.e. the method name?


Messages In This Thread
Routing and Remap - by El Forum - 02-07-2010, 02:34 AM
Routing and Remap - by El Forum - 02-07-2010, 04:20 PM
Routing and Remap - by El Forum - 02-07-2010, 04:47 PM
Routing and Remap - by El Forum - 02-07-2010, 04:50 PM
Routing and Remap - by El Forum - 02-07-2010, 04:54 PM
Routing and Remap - by El Forum - 02-07-2010, 04:56 PM
Routing and Remap - by El Forum - 02-07-2010, 05:05 PM
Routing and Remap - by El Forum - 02-07-2010, 05:29 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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