Welcome Guest, Not a member yet? Register   Sign In
Pagination with standard CI urls + query strings
#2

[eluser]CroNiX[/eluser]
Hey Brian,

Hope things are good with ya.

Not having to do with the suffix question, but this might be of use to you:
https://github.com/CroNiX/CI-MY_URI-Segm...MY_URI.php

It kind of allow you to use "hybrid" query strings, like:
Code:
http://www.yoursite.com/users/list/page=5;limit=50;per_page=25
Where the 3rd segment is the hybrid query string. To get the data out of there you would:

Code:
$parameters = $this->uri->segment_to_assoc(3);
print_r($parameters);

//outputs
array(
  'page'     => 5,
  'limit'    => 50,
  'per_page' => 25
)
You just need to add the following 2 characters to your $config['permitted_uri_chars']: ';=', which are normally allowed anyway and shouldn't interfere with anything else.

It just doesn't use the question mark or ampersand in the "hybrid query string", but it allows you to stuff multiple parameters into a single segment. I use this for a custom pagination library and a few other things, and it's worked very well thus far. I just pass that segment and it does the rest.


Messages In This Thread
Pagination with standard CI urls + query strings - by El Forum - 02-07-2012, 04:55 PM
Pagination with standard CI urls + query strings - by El Forum - 02-07-2012, 05:36 PM
Pagination with standard CI urls + query strings - by El Forum - 02-07-2012, 11:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB