0

See: http://codeigniter.com/user_guide/libraries/pagination.html

I do not want to use URI segments for my pagination (as I have a lot of possible parameters to pass in unknown order). Currently, I have $config['enable_query_strings'] = FALSE;, and if I set it to TRUE, I get something like this (from CI's example):

http://example.com/index.php?c=test&m=page&per_page=20

Where "c" is the controller, "m" is the method, etc. This is not what I want.

I want something like this:

http://domain.com/?min_amount=100&max_amount=200&color=blue&size=large&limit=20&limit_offset=100

Is there a way to achieve this in CI? If not, is there some library already available that I can use?

StackOverflowNewbie
  • 39,403
  • 111
  • 277
  • 441

1 Answers1

0

In CodeIgniter, there are two configuration options when it comes to query strings.

One option ($config['allow_get_array'], enabled by default) allows you to pass additional queries on to the already segmented URI, which would then be available via the $this->input->get() controller library function. You would set the pagination config using this function, allowing you to separate the route, and the pagination instructions.

The other option ($config['enable_query_strings']) forces you to use the query strings in place of the segmented URIs.

Mike Rockétt
  • 8,947
  • 4
  • 45
  • 81
  • I have not changed my config variables. The problem exist under the default settings. 'enable_query_strings' is not what I want per my original post. – StackOverflowNewbie Sep 12 '12 at 13:18
  • This is why I mentioned the first parameter, `allow_get_array`. Sure, my CI install is modified, and that setting was defaulted to `false`. My pagination works with the `GET` array, and I have my segments in place. – Mike Rockétt Sep 13 '12 at 05:31
  • `allow_get_array` is also enabled for me. I am using URI segments and I want to use query strings. Is that how you have yours set up? – StackOverflowNewbie Sep 13 '12 at 09:20
  • Indeed, it is. I pass the parameters from the `GET` array to the Pagination class. Have you set `$config['uri_protocol']` to `"PATH_INFO"` in `config.php`? See [this answer](http://stackoverflow.com/a/4073400/1626250) for information. – Mike Rockétt Sep 13 '12 at 10:35