From 8ddc0db3bb835fbb880c25882b1016747527742c Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Wed, 21 May 2008 04:54:39 +0000 Subject: Added support for query strings to the Pagination class, automatically detected or explicitly declared. --- system/libraries/Pagination.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'system/libraries') 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 = ''; -- cgit v1.2.3-24-g4f1b