diff options
author | Derek Allard <derek.allard@ellislab.com> | 2008-05-21 06:54:39 +0200 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2008-05-21 06:54:39 +0200 |
commit | 8ddc0db3bb835fbb880c25882b1016747527742c (patch) | |
tree | 9db607ecc9bdbfc678d92337138fc80410f3d9d2 /system/libraries | |
parent | bd08d84525e5f9af869d3aaba92906d2047272cc (diff) |
Added support for query strings to the Pagination class, automatically detected or explicitly declared.
Diffstat (limited to 'system/libraries')
-rw-r--r-- | system/libraries/Pagination.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 10af3fd11..2b8d3e454 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -50,6 +50,7 @@ class CI_Pagination { var $prev_tag_close = '';
var $num_tag_open = ' ';
var $num_tag_close = '';
+ var $page_query_string = FALSE;
/**
* Constructor
@@ -152,8 +153,16 @@ class CI_Pagination { $start = (($this->cur_page - $this->num_links) > 0) ? $this->cur_page - ($this->num_links - 1) : 1;
$end = (($this->cur_page + $this->num_links) < $num_pages) ? $this->cur_page + $this->num_links : $num_pages;
- // Add a trailing slash to the base URL if needed
- $this->base_url = rtrim($this->base_url, '/') .'/';
+ // Is pagination being used over GET or POST? If get, add a per_page query
+ // string. If post, add a trailing slash to the base URL if needed
+ if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE)
+ {
+ $this->base_url = rtrim($this->base_url).AMP.'per_page=';
+ }
+ else
+ {
+ $this->base_url = rtrim($this->base_url, '/') .'/';
+ }
// And here we go...
$output = '';
|