Welcome Guest, Not a member yet? Register   Sign In
No segments found using uri class...
#1

[eluser]Unknown[/eluser]
When I tried to retrieve any segment of the uri, using $this->uri->segment(2), I get none. Also, the uri segments array is empty. Could it be it has something to do with the url?

I work local: http://localhost/eclipse/codeigniter/ind.../parameter

But when I make a function named like the parameter, he does run that function. And still the uri segments array is empty.

Any ideas how this could be solved?


This is the code:
Code:
<?php

class Overview extends Controller {

    function Overview()
    {
        
        parent::Controller();
        print_r($this->uri->segment_array());
        
    }

    function index()
    {
    
        print("param:" . $this->uri->segment(0). " " .$this->uri->segment(1));
        
    }
    
    function _remap($method)
    {
        if(method_exists($this, $method))
            call_user_func_array(array(&$this, $method), array_slice($this->uri->segment_array(), 2));
        else
            call_user_func_array(array(&$this, 'index'), array_slice($this->uri->segment_array(), 1));
    }
    
}

?>

And this is the return for http://localhost/eclipse/codeigniter/ind...parameter/:
Code:
Array
(
)
param:
#2

[eluser]Unknown[/eluser]
Solved! %-P

I'd placed 'uri' in the libraries autoload array. But Codeigniter loads it anyways. Loading it twice caused the problem.
#3

[eluser]Las3r[/eluser]
Yea you saved me loads of time here, thanks for that!

I spent 30 minutes trying to find out why it wouldnt retrieve my segments... Big Grin

Thanks a lot Doudi Smile




Theme © iAndrew 2016 - Forum software by © MyBB