• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Auto set routes in codeigniter

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.php/?route=common/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!

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.

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:

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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