$_GET + Nice URLs ??!?? |
[eluser]llbbl[/eluser]
So there is no way to have the best of both worlds is there? I know about uri class: $suckage = $this->uri->segment(3,0); But I am finding that it would also be nice to have $_GET for *some* pages. (You know example.php?irule=yea&sodoes=codeigniter) However I don't want to turn off nice urls for the ENTIRE freaking site.
[eluser]Majd Taby[/eluser]
Do you think it would be useful to write a controller which converts something like http://www.site.com/controller/function/params/foo/bar which would take the urls, look for a "params" in it, if it has it, then it treats foo and bar as $_GET['foo'] = $bar? and passes them to controller::function? $this->uri->uri_to_assoc(n) (http://ellislab.com/codeigniter/user-gui...s/uri.html) looks promising
[eluser]llbbl[/eluser]
It is not what I want to do, and I don't think it is possible, because everything is passed through index.php. I am in essentially wanting index.php/p/12323/ and index.php?p=32154 to work differently.
[eluser]onejaguar[/eluser]
Stick this in a library, call as needed: Code: //
[eluser]llbbl[/eluser]
I have been using something like this for several years now. (get/post) Code: foreach($_POST AS $key => $value) { But that is not what I am looking for. Thanks for trying.
[eluser]llbbl[/eluser]
I believe in using php functions whenever possible, to avoid any additional hit to the CPU.
[eluser]onejaguar[/eluser]
My code puts GET variables into $_POST but you could easily change it to put them into $_GET and leave out the cleaning bits. It would look like this: Code: function recoverGet() { This allows you to use paths for calling controller functions and use GET variables at the same time. If you alternately want to use the path or GET for calling controller functions, setting your config to: $config[’uri_protocol’] = “AUTO”; Should handle both.
[eluser]llbbl[/eluser]
Ok I see now. Still not what I am looking for. I know I didn't explain the problem very well, sorry about wasting your time. I have solved the problem using sessions, by setting a custom session variable with the information I needed.
[eluser]mistress_shiira[/eluser]
[quote author="llbbl" date="1194591251"]Ok I see now. Still not what I am looking for. I know I didn't explain the problem very well, sorry about wasting your time. I have solved the problem using sessions, by setting a custom session variable with the information I needed.[/quote] can you explain more in detail how you have achieved that?cause i might be able to use that too.i have also problems in $_GET variables for some of my pages. like i have this snippet: Quote: <a href='editcampaign.php?CID=$campaign_ID'>$campaign_name</a>id like to redirect it to editcampaign.php with the CID. how is that going to be in CI?
[eluser]llbbl[/eluser]
use the URI class: http://ellislab.com/codeigniter/user-gui...s/uri.html results in: <a href=’editcampaign/CID/$campaign_ID’>$campaign_name</a> You can't use GET in normal way with CI because of the MVC configuration with everything being a class passed through index.php. editcampaign would be your class CID would be a function within the class using URI class you can pull the campaign_id from the url get it now? you should really spend some time reading the user guide. |
Welcome Guest, Not a member yet? Register Sign In |