• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to pass a parameter to the controller through the route?

#1
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!
Reply

#2
(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:

PHP Code:
$route['default_controller'] = array('normalroute'$parameter); 

Can anyone give me a hint on how to do it? Ty!

$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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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