CodeIgniter Forums
parameter before controller name - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: parameter before controller name (/showthread.php?tid=56228)



parameter before controller name - El Forum - 12-04-2012

[eluser]Unknown[/eluser]
Hi Guys ,,,

How are you all ?


first of all , I'm sorry for weak English

I want to pass a parameter before Controller name , and i search hours and hours and i didn't find a solution


normal URL:
http://sitename/index.php/controllername/functionname/par1

what I want :
http://sitename/index.php/HERE/controllername/functionname/par1

So, If any one can help me ?




parameter before controller name - El Forum - 12-04-2012

[eluser]leet_2k[/eluser]
Hi ayyad1990,


Go to:

applications/config/routes.php

Put the following under URI ROUTING:

$route['(:any)/controllername/function'] = "controllername/function";

What you are telling in the line above is anything before a controllername send it to controllername CONTROLLER .

Hope that helps.



parameter before controller name - El Forum - 12-04-2012

[eluser]Unknown[/eluser]
[quote author="leet_2k" date="1354653364"]Hi ayyad1990,


Go to:

applications/config/routes.php

Put the following under URI ROUTING:

$route['(:any)/controllername/function'] = "controllername/function";

What you are telling in the line above is anything before a controllername send it to controllername CONTROLLER .

Hope that helps.
[/quote]

thanks ,

But I have many and many of controllers , this way is not sufficent !!!




parameter before controller name - El Forum - 12-05-2012

[eluser]CroNiX[/eluser]
Well, you want to go against the default behavior of codeigniter, so it will involve a not so easy solution. CI provides the routes to allow you to do what you are wanting to do (bypass default behavior).