Welcome Guest, Not a member yet? Register   Sign In
dynamic functions
#5

[eluser]Michael Wales[/eluser]
Create a route for all of your named methods (the ones in which you know exist). The last route in your routes.php file should point towards the user-handling method().

Since routing works from top-to-bottom, all of your known controllers will be picked up by their respective routes and anything left over will be picked up by the user handler.

Example: The following will forward any requests for blog/(number) to the correct controller and anything else will be forwarded to the user controller (to display a profile or something).

Code:
$route['default_controller'] = "home";
$route['scaffolding_trigger'] = "";
$route['blog/(\d+)'] = "blog/view/$1";
$route['([a-z]+)'] = "user/view/$1";

Note: Don't quote my regex, I really suck at it.


Messages In This Thread
dynamic functions - by El Forum - 10-10-2007, 10:22 PM
dynamic functions - by El Forum - 10-10-2007, 10:55 PM
dynamic functions - by El Forum - 10-10-2007, 11:34 PM
dynamic functions - by El Forum - 10-11-2007, 08:06 AM
dynamic functions - by El Forum - 10-11-2007, 10:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB