I am new to CI and need some beginner's help from experts.
Here is what my current setup is: /controllers/
- home.php
- report.php
/views/
- home/index.php
- home/recent.php
- report/index.php
- report/generate.php
the URI i am trying to produce as an outcome:
http://localhost http://localhost/report (would load the index.php) http://localhost/report/generate (would call the method for generate in the report controller)
http://localhost/recent/10 (would call the method for generate in the home controller passing the variable '10')
$route['default_controller'] = "home";
$route['404_override'] = '';
$route['/'] = 'home/index';
$route['recent/(:num)'] = 'home/recent/$1';
$route['report/(:any)'] = 'report/$1';
How do i avoid always modifying the routes file for each new method created in a class? so that it would follow: $route[$controller/$method/$variable] (very use to how .net mvc routing is setup).
Any help is appreciated.