CodeIgniter Forums
Routes with 2 variables CI3 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Routes with 2 variables CI3 (/showthread.php?tid=80377)



Routes with 2 variables CI3 - Omar Crespo - 10-25-2021

Hello. I need something like this:

$route['controller1/function'] = 'controller2/funtion/var1=thing/var2=otherthing';

But it doesn't work.


$route['controller1/function'] = 'controller2/funtion/thing/otherthing';

Doesn't work.
The thing is: I want to modify de values of privates attributes inside the controller so it works in several ways based on the URL.


RE: Routes with 2 variables CI3 - includebeer - 10-25-2021

Try something like that:
PHP Code:
$route['controller1/function'/(:any)/(:any)] = 'controller2/funtion/$1/$2'

See https://codeigniter.com/userguide3/general/routing.html