Welcome Guest, Not a member yet? Register   Sign In
Simple Query String Handler
#5

[eluser]Miroslav Milic[/eluser]
I had the same problem.
Thing is that Input library is destroying $_GET array when enable_query_strings is set to false and that is the case with standard CI configuration.

If you want to use $this->input->get() and $this->input->get_post() you can extend Input library with this code:
Code:
class MY_Input extends CI_Input {

    function MY_Input()
    {
        $CFG =& load_class('Config');

        // Remeber old setting
        $tmp = $CFG->item('enable_query_strings');

        // Set the enable_query_string to true so Input lib will not destroy $_GET array
        $CFG->set_item('enable_query_strings', TRUE);

        // In this special case we need to manualy parse the get query
        // (when using htaccess to hide index.php on some hosts)
        if ($CFG->item('index_page') == '' && $CFG->item('uri_protocol') == 'QUERY_STRING') {
            $get_array = array();
            parse_str(parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY), $get_array);
            $_GET = $get_array;
        }

        // Initialize Input library
        parent::CI_Input();

        // Set the old setting back
        $CFG->set_item('enable_query_strings', $tmp);
    }

}


Messages In This Thread
Simple Query String Handler - by El Forum - 01-02-2011, 02:52 PM
Simple Query String Handler - by El Forum - 01-04-2011, 09:36 PM
Simple Query String Handler - by El Forum - 01-05-2011, 09:33 AM
Simple Query String Handler - by El Forum - 01-05-2011, 09:59 AM
Simple Query String Handler - by El Forum - 03-04-2011, 02:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB