Welcome Guest, Not a member yet? Register   Sign In
$this->uri->uri_to_assoc(3, $default); strange behavior
#1

[eluser]smith[/eluser]
example:

controller:
Code:
class Some_class extends Controller {

    var $data = array();
    function Some_class()
    {
        parent::Controller();
        
        $this->load->database();
        $this->load->model('my_model');
        $this->my_model->some_function();
    }
    
    function index()
    {
        $default = array('var1','var2');
        $array = $this->uri->uri_to_assoc(3, $default);
        print_r ($array);
    }
}

model:
Code:
class My_model extends Model {

    function some_function()
    {
        $default = array('var3');
        $array = $this->uri->uri_to_assoc(3, $default);
        print_r ($array);
    }
}

Now, when controller is executed, first uri_to_assoc will execute and set false to var3 if var3 is not found inside uri segment, but second execution, inside index function will not set var1 and var2 to false if they are not found inside uri segment. Now, i don't know how to solve this problem and it is crucial for my current project, i am stuck and behind deadline. Any help?




Theme © iAndrew 2016 - Forum software by © MyBB