Welcome Guest, Not a member yet? Register   Sign In
$_GET
#1

[eluser]Joshua Baker[/eluser]
This solution seems to be working for me in applications where I need to have access to $_GET.


Basically I override the core input class and use $_SERVER['REQUEST_URI'] to repopulate $_GET.

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Input extends CI_Input
{
    function MY_Input()
    {
        parent::CI_Input();
        $pos = strrpos($_SERVER['REQUEST_URI'], '?');
        $qry = is_int($pos) ? substr($_SERVER['REQUEST_URI'], ++$pos) : '';
        parse_str($qry, $_GET);
    }
    
}


Getting a parameter is as simple as using the default method.

Code:
$this->input->get('index');


Let me know if this works for you or if you have a better solution.
#2

[eluser]Buso[/eluser]
I can't imagine why you need this. Could you give an example?
#3

[eluser]Joshua Baker[/eluser]
There's plenty of applications for $_GET. Here's a few that come to mind:

- OAUTH. For example Twitter and Facebook pass session parameters via $_GET.

- Facebook canvas IFRAMES, which is why I built this in the first place.

- A $_GET['redirect'] for a login page, which is easy/developer friendly.
#4

[eluser]n0xie[/eluser]
http://github.com/dhorrigan/codeigniter-query-string
#5

[eluser]quasiperfect[/eluser]
thanks n0xie u saved my ...




Theme © iAndrew 2016 - Forum software by © MyBB