how to pass a parameter to the controller through the route? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17) +--- Thread: how to pass a parameter to the controller through the route? (/showthread.php?tid=66064) |
how to pass a parameter to the controller through the route? - Angelo - 08-30-2016 Hello guys! I need to pass a parameter to the controller through the route, however, as it is a fixed parameter for each route does not want him to interfere in the url. It is something like this: PHP Code: $route['default_controller'] = array('normalroute', $parameter); Can anyone give me a hint on how to do it? Ty! RE: how to pass a parameter to the controller through the route? - portaflex - 08-30-2016 (08-30-2016, 01:28 PM)Angelo Wrote: Hello guys! I need to pass a parameter to the controller through the route, however, as it is a fixed parameter for each route does not want him to interfere in the url. It is something like this: $route['default_controller'], as the name says, just set the default controller when you enter http://yourdomain.com in the URL. In your case i would use: PHP Code: $route['/(:any)'] = '/normalroute/$1'; Or you can just set your default controller to 'normalroute': PHP Code: $route['default_controller'] = "normalroute"; Every call to http://yourdomain.com would go to your 'normalroute' and every parameter passed to it. Here is the explanation Hope this helps. Regards. |