[SOLVED] How to use URI Segments and Query Strings in the same project |
[eluser]fensen[/eluser]
CodeIgniter is SO powerful! If you want to use URI Segments and Query Strings in the same project, go to Code: APP/config/config.php Code: $config['uri_protocol'] = "PATH_INFO"; This will allow you to use URI Segments, URI Segments parameters and Query String parameters! e.g. Code: /controller/method/param1/param2/?param3=xxx¶m4=yyy This has just saved my life!!!
[eluser]Phil Sturgeon[/eluser]
Nicely done, had been wondering how to mix them for a while now. This has been tested and works nicely! :-)
[eluser]amrnt[/eluser]
[quote author="fabian_o" date="1229074725"]CodeIgniter is SO powerful! If you want to use URI Segments and Query Strings in the same project, go to Code: APP/config/config.php Code: $config['uri_protocol'] = "PATH_INFO"; This will allow you to use URI Segments, URI Segments parameters and Query String parameters! e.g. Code: /controller/method/param1/param2/?param3=xxx¶m4=yyy This has just saved my life!!![/quote] HOW it saves your life... it doesn't work with me ~~~!!! when i write www.xppx.com/controller/function/ it returns me to the root page without changes in the URL moreover when i supply params to become www.xppx.com/WHATEVER_TEXT_OR_WITHOUT/?c=controller$m=function it works fine....
[eluser]Bahodir[/eluser]
maybe you should write something like this: www.xppx.com/index.php/controller/function/
[eluser]lifo101[/eluser]
(sorry for waking an old thread) Does anyone know of any OS specific side effects by using PATH_INFO like this? (eg: IIS on Windows)
[eluser]PHP Creative[/eluser]
Sorry for bumping this thread. ![]() With this setup, I need to use the index.php in the URL. Is there anyway to get around this? Thanks a million
[eluser]Zorancho[/eluser]
I am using .htaccess to remove the index.php from the url. By using this approach about query strings i am able to do this: http://www.example.com/products/edit/2?category=32 Then i can get the 2 which is the id of the product like this in my controller: Code: function edit($id = 0) Is there anything wrong with this?
[eluser]rebellion[/eluser]
This doesn't work with me neither. I'm using an SMS service that sends get variables to an URL, in my case: http://mydomain.com/sms/receive_sms/ But CodeIgniter can't read http://mydomain.com/sms/receive_sms/?msgid=x&number=x etc. What to do? :/
[eluser]mindprojects[/eluser]
Fully working! Perfect...this morning i was struggling with this as well.... The only problem will be with the pagination.....on how to get the right uri segment.
[eluser]mindprojects[/eluser]
For the pagination we'll need to create a custom pagination to append the query string everytime at the end of the url string so that the URI SEGMENT will be at the same place everytime.We we'll have to build something like: eg: controller/function/offset?QUERY_STRING |
Welcome Guest, Not a member yet? Register Sign In |