Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //remember that custom routes need to go _after_ ci's default routes, as they're executed in the order you provide them
- $route['default_controller'] = "welcome";
- $route['404_override'] = '';
- //exception 1 to your regex here
- //exception 2 to your regex here
- //so on...
- $route['(:any)/(:any)/(:any)'] = "$2/$3/$1";
- $route['([^/]+)/([^/]+)/([^/]+)'] = "$2/$3/$1";
- $route['a/([^/]+)/([^/]+)/([^/]+)'] = "$2/$3/$1";
- $route['(:any)/some_controller/method/'] = "some_controller/method/$1";
- function method($my_param) {
- echo 'my param is '. $my_param;
- }
- $route['(:num)/blog/entry/'] = "blog/view/$1";
- class Blog extends CI_Controller {
- function view($id) {
- echo 'fetching blog entry no ' . $id;
- }
- }
- <html>
- <body>
- link to <?= anchor('1/blog/entry/','my first post'); ?>
- link to <?= anchor('2/blog/entry/','my second post'); ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment