Welcome Guest, Not a member yet? Register   Sign In
Auto set routes in codeigniter
#1

I would like to know if it is possible to get codeigniter routes.php to auto detect routes.

Because each time I have to create a route like below

PHP Code:
$route['route=common/dashboard'] = 'common/dashboard/index';
$route['route=user/user'] = 'user/user/index';
$route['route=user/user/edit(:any)'] = 'user/user/edit$1'

I can get route by just doing this echo $this->input->get('route');

I also have enabled $config['uri_protocol'] = 'QUERY_STRING'; to make it work with my htaccess

Example Link http://localhost/project-dashboard/index.../dashboard working perfect

I will save a lot of time. Any suggestions.
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply
#2

Based on your description, everything should work fine if you simply delete your custom routes. As long as your routes match the format controller/method/parameters and your paths are set correctly, you do not need to manually define routes.
Reply
#3

If all you want to do is be able to see your route, you don't need to have a query string. Just use the URI class:


PHP Code:
$this->uri->uri_string(); 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB