CodeIgniter Forums
Use controller as input parameter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Use controller as input parameter (/showthread.php?tid=57242)



Use controller as input parameter - El Forum - 02-28-2013

[eluser]Unknown[/eluser]
Hi,
I'm new to CI and have been exploring it regularly. I came across this problem while creating a sample program:

CI URL: http://domain.com/controller/class/arguments

What if I want to use the controller as an input parameter instead of using the above?

Eg: http://domain.com/arguments
http://domain.com/jack123

Please help me with this. Thanks in advance.


Use controller as input parameter - El Forum - 02-28-2013

[eluser]Eduard Stankovic[/eluser]
edit your application/config/routes.php file and add something like this
Code:
$routes['(:any)'] = 'controller/method/$1';

but it doesn't work for more controllers.


Use controller as input parameter - El Forum - 02-28-2013

[eluser]Unknown[/eluser]
Nice! I fixed it for my site! .thank you
-----------------------------------------------------------------
[URL="http://memoryzone.com.vn"]memoryzone[/URL]


Use controller as input parameter - El Forum - 03-01-2013

[eluser]greedyman[/eluser]
[quote author="shubhodeep" date="1362043963"]Hi,
I'm new to CI and have been exploring it regularly. I came across this problem while creating a sample program:

CI URL: http://domain.com/controller/class/arguments

What if I want to use the controller as an input parameter instead of using the above?

Eg: http://domain.com/arguments
http://domain.com/jack123

Please help me with this. Thanks in advance.[/quote]

You can use "segment" to take controller from url, and you can use it to do something. And arguments is not controller as example you gave, it's only parameter.