uri_to_assoc problem |
[eluser]smith[/eluser]
When controller is executed, first uri_to_assoc(model) will execute and set false to var3 if var3 is not found inside uri segment, but second execution (controller), inside index function will not set var1 and var2 to false if they are not found inside uri segment. Looks like uri_to_assoc can only be called once? Code Sample: controller: Code: class Some_class extends Controller { model: Code: class My_model extends Model { I would expect to have this as a result: Array ( [var3] => ) Array ( [var1] => [var2] => ) But instead i am getting this: Array ( [var3] => ) Array ( [var3] => )
[eluser]gtech[/eluser]
Hello, I read your post and cut and pasted your code exactly. I typed the URL (http://localhost/..<myinstall>../index.php/some_class/) in firefox on a windows platform and I got the following result: Code: Array ( [var3] => ) Array ( [var1] => [var2] => )
[eluser]smith[/eluser]
Same here. But when i do this: http://localhost/..<myinstall>../index.p...dex/var3/2 i get: Array ( [var3] => 2 ) Array ( [var3] => 2 ) var1 and var2 were not set to false. if i do this: http://localhost/..<myinstall>../index.p...dex/var2/2 result: Array ( [var2] => 2 [var3] => ) Array ( [var2] => 2 [var3] => ) var1 was not set to false.
[eluser]gtech[/eluser]
its because in the URI code the array is cached see line 202 libraries/URI.php Code: $this->keyval[$n] = $retval; when you call the uri_to_assoc function again it checks the cached value and just returns it see line 150 libraries/URI.php Code: if (isset($this->keyval[$n])) comment this line out and the code works like you want.. OR Code: <?php
|
Welcome Guest, Not a member yet? Register Sign In |