Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] uri segmet confusion
#1

[eluser]zovar[/eluser]
Well it's my second topic here. The first was about scaffolding, this one is about uri -> segment action.

It just doesn't work... I have mod_rewrite working, helper uri is autoloading, when I go to http://webz/notes/1 - it displays my page, so routing is OK, but when I echo
Code:
$this->uri->rsegment(1)
it shows nothing. rsegment also, uri_string also. it doesn't show errors - just empty output. what am i doing wrong? can somebody help please?
#2

[eluser]zovar[/eluser]
OK, i installed a fresh version of CI - just for testing. In welcome controller I have
Code:
function index()
    {
        $data['test'] =  $this->uri->uri_string();
        $this->load->view('welcome_message', $data);
    }

in welcome view I typed
Quote:<?=$test?>

the output is '/welcome'. So it works...

What could be a problem with my original code?
#3

[eluser]zovar[/eluser]
SOLVED

After comparing autoload.php files from fresh and old installation line by line, I have found the problem. Don't autoload 'uri' library! It load automatically and if you load it for the second time - it will brake itself.

I think the official tutorial still contains an advice to load it manually though...




Theme © iAndrew 2016 - Forum software by © MyBB