Welcome Guest, Not a member yet? Register   Sign In
Please consider querystring support in 2.x
#41

[eluser]DJMOHNL[/eluser]
i support this topic!!
#42

[eluser]DJMOHNL[/eluser]
DOWNLOAD THE PATCH HERE: DOWNLOAD THE GET PATCH FOR CI 1.7.x + thanks for helping, with this usefull post!
#43

[eluser]skunkbad[/eluser]
DJMOHNL, you probably ought to set $config['allow_get_array'] to TRUE by default.
#44

[eluser]jkevinburton[/eluser]
/applications/libraries/MY_Input.php

Code:
<?php
class MY_Input extends CI_input {
    function _sanitize_globals() {
        $this->allow_get_array = TRUE;
        parent::_sanitize_globals();
    }
}
?>

with that you can use the $_GET array with segments:

http://example.com/controller/method/?hello=world
#45

[eluser]pbreit[/eluser]
Coder, is that a complete solution? Any side effects?
#46

[eluser]WanWizard[/eluser]
That should work without side effects, allow_get_array is only used there.

If it makes you feel better, you can store the value of allow_get_array, and restore it after the call to sanitize_globals.
#47

[eluser]skunkbad[/eluser]
[quote author="WanWizard" date="1277927932"]The Input library assumes that 'enable_query_strings' == 'allow_get_array', which is not the case. The first one is your config 'switch' to decide if you want to use URI segments or the query string to define the controller/method load, the second one whether or not to erase the $_GET array. This two functions need to be split (and a config value needs to be defined for the latter).

The URI library (protocol == 'AUTO') assumes that if the $_GET array has values, they should be used for determining the URI string. Which is not the case, the 'enable_query_string' should be used to determine that. This has been correctly implemented in the Router class (_set_routing).

Structural solution for CI v1.7.2:
- add a new config variable 'allow_get_array' (boolean, default FALSE)
- in ./system/codeigniter/Codeigniter.php, move loading the Input class up, between the Config and the URI class
- in the Input library, create a new class variable 'enable_query_strings', and assign the config value to it
- in the Input library constructor, load and store the 'allow_get_array' value separate from the 'enable_query_strings' value
- in the URI library, only use $_GET if 'enable_query_strings' is TRUE[/quote]

To some degree I understand what is going on after looking at the classes, and your first two paragraphs here make sense. I do have some questions, and forgive me if this has already been explained:

1) Once we are getting the value of allow_get_array from our new config variable, why do we care if there is a enable_query_strings variable in the Input class? It doesn't seem to get used anywhere in the class. Are other classes checking this value here instead of getting it from the config class?

2) What is the reason why the Input class needs to load between Config and URI?
#48

[eluser]skunkbad[/eluser]
[quote author="WanWizard" date="1280489176"]That should work without side effects, allow_get_array is only used there.

If it makes you feel better, you can store the value of allow_get_array, and restore it after the call to sanitize_globals.[/quote]

But what about the URI String if the uri protocol is auto? I'm confused unless you weren't referring to post #43.
#49

[eluser]WanWizard[/eluser]
[quote author="skunkbad" date="1280491778"]But what about the URI String if the uri protocol is auto? I'm confused unless you weren't referring to post #43.[/quote]
I was referring to the question of @pbreit, post #44.
#50

[eluser]skunkbad[/eluser]
[quote author="WanWizard" date="1280492929"][quote author="skunkbad" date="1280491778"]But what about the URI String if the uri protocol is auto? I'm confused unless you weren't referring to post #43.[/quote]
I was referring to the question of @pbreit, post #44.[/quote]

WanWizard, did you see my post 46? I had some questions for you.




Theme © iAndrew 2016 - Forum software by © MyBB