summaryrefslogtreecommitdiffstats
path: root/system/libraries/Pagination.php
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2008-05-21 06:54:39 +0200
committerDerek Allard <derek.allard@ellislab.com>2008-05-21 06:54:39 +0200
commit8ddc0db3bb835fbb880c25882b1016747527742c (patch)
tree9db607ecc9bdbfc678d92337138fc80410f3d9d2 /system/libraries/Pagination.php
parentbd08d84525e5f9af869d3aaba92906d2047272cc (diff)
Added support for query strings to the Pagination class, automatically detected or explicitly declared.
Diffstat (limited to 'system/libraries/Pagination.php')
-rw-r--r--system/libraries/Pagination.php13
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 = '&nbsp;';
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 = '';