Welcome Guest, Not a member yet? Register   Sign In
How to differentiate between controller files/controller methods/ and controller parameters in a url.
#11

[eluser]CroNiX[/eluser]
Code:
$route['edit_section/(:any')] = "admin/edit_section/index/$1";
You need the full route on the right side of the =, including any subfolder the controller is in. This route will pass anything after the 'edit_section' segment to the index method of your edit_section controller in the admin directory.

So if the url was www.yoursite.com/edit_section/about_us, it would send 'about_us' to the index method of the 'edit_section' controller, overriding your default value, 'Default'.

BTW, 'section' should be $section in your index method parameter.
#12

[eluser]lanzd[/eluser]
Thank you, It took a little playing around with until I got it.

The ultimate line I needed to accomplish this (for anyone reading this in the future) was this line:

Code:
$route['admin/edit_section/(:any)'] = "admin/edit_section/index/$1";

I put it after these two lines in "mywebsite.com/application/config/routes.php"

Code:
$route['default_controller'] = "welcome";
$route['404_override'] = '';

I will also create custom pages for 'default_controller' and '404_override', I'm just still developing.

Thank you all again!




Theme © iAndrew 2016 - Forum software by © MyBB