0

I'm having a problem with codeigniter segments.

Im looking for something like this where my controller is contacts and the action is list:

localhost/index.php/contacts/list/limit/10/offset/100/orderBy/postalCode/search/john/

This way I can mix my parameters up, they dont have to be in that specific order, or I can leave them out all together, for instance:

localhost/index.php/contacts/list/search/john/

How do I get this, because the way I see it, I can only request a segment like so:

$this->uri->segment(3);

But segment 3 can cary a offset value or a limit value, or something completely different.

Much appreciated

tereško
  • 58,060
  • 25
  • 98
  • 150
Thijs van Beek
  • 105
  • 1
  • 5
  • 1
    I'm sure that this question has been answered before on SO: http://stackoverflow.com/search?q=codeigniter+variable+segments – Robert Jul 17 '12 at 15:01
  • You should really just enable querystrings in your CI config, rather than jumping through hoops to implement your own. – Sam Dufel Jul 17 '12 at 15:05

1 Answers1

3

Use $this->uri->uri_to_assoc() to get the parameters as explained here.

Yan Berk
  • 14,328
  • 9
  • 55
  • 52