Welcome Guest, Not a member yet? Register   Sign In
$this->uri->rsegments versus $this->uri->segments: subdirectory gets lost?

Hello I use the resegment(n) function to get data from the routed uri.

the problem is when there wasn a routing the VAR $this->uri->rsegments holds different data than $this->uri->segments - that seems to be wrongto me.

URI: /index.php/admin/order/1000/invoice/
//no routing defined in routes.php!

// Array ( [1] => admin [2] => order [3] => 1000 [4] => invoice )

// Array ( [1] => order [2] => 1000 [3] => invoice )

Yes, you're.

This seems to be a bug.

And my friend found the below result:
URI: /index.php/admin/

// Array ( [1] => admin )

// Array ( )

the bug is still present in 1.6.3

Is there an offcial bugfix? Could not find one...
Should I post it to the bugtracker?

[eluser]Derek Allard[/eluser]
rsegment is intended to be used "in the event you are using CodeIgniter's URI Routing feature." If routing isn't being used, does it still make sense that rsegment be available? If you still think so (I'm not sure, my knee jerk is that it shouldn't but I'm open to having my mind changed) do you have a proposed code change?

[eluser]Colin Williams[/eluser]
I'm kinda with you Derek. If I improperly use rsegment but don't see the err of my ways, I might be going batty when I actually do set up a route for this context. Might be good to leave the awkward handling, or even return FALSE if there is no route to parse.

[eluser]Michael Wales[/eluser]
To be honest, I've never had a need for rsegment...

If I have the following URL: domain.com/walesmd
and I am using routing to push it to: users/view/walesmd

My function would be:

function view($username = NULL) {
  echo $username . ' or ';
  echo $this->uri->segment(1);

Never had any problems thus far...

Theme © iAndrew 2016 - Forum software by © MyBB