From 8bd8f687827454f83a5512b96bb0f632178a08a6 Mon Sep 17 00:00:00 2001 From: dixy Date: Mon, 19 Dec 2011 22:26:12 +0100 Subject: Prev link and 1 link don't have the same url with use_page_numbers=TRUE --- system/libraries/Pagination.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index eea953ae4..cc73e0d2f 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -236,13 +236,13 @@ class CI_Pagination { { $i = ($this->use_page_numbers) ? $uri_page_number - 1 : $uri_page_number - $this->per_page; - if (($i == 0 OR ($this->use_page_numbers && $i == 1)) AND $this->first_url != '') + if ($i == $base_page AND $this->first_url != '') { $output .= $this->prev_tag_open.'anchor_class.'href="'.$this->first_url.'">'.$this->prev_link.''.$this->prev_tag_close; } else { - $i = ($i == 0) ? '' : $this->prefix.$i.$this->suffix; + $i = ($i == $base_page) ? '' : $this->prefix.$i.$this->suffix; $output .= $this->prev_tag_open.'anchor_class.'href="'.$this->base_url.$i.'">'.$this->prev_link.''.$this->prev_tag_close; } -- cgit v1.2.3-24-g4f1b From 8d727f14446f31d919e808e3833d252ef12cf1ae Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Wed, 4 Jan 2012 00:06:36 -0500 Subject: Fixed prefix and suffix in pagination. Fixes #677 --- system/libraries/Pagination.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'system') diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 23ca549e2..2fe4cf31b 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -142,6 +142,11 @@ class CI_Pagination { // Determine the current page number. $CI =& get_instance(); + if ($this->prefix != '' OR $this->suffix != '') + { + $this->cur_page = str_replace(array($this->prefix, $this->suffix), '', $CI->uri->segment($this->uri_segment)); + } + if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE) { if ($CI->input->get($this->query_string_segment) != $base_page) -- cgit v1.2.3-24-g4f1b From 3b376595183e0e0db5559ccbfc368c442408dca9 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Wed, 4 Jan 2012 00:28:27 -0500 Subject: Fixed paging with prefix and suffix for real page numbers. Refs #677 Fixes #52 --- system/libraries/Pagination.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'system') diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 2fe4cf31b..e0cab2128 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -142,9 +142,10 @@ class CI_Pagination { // Determine the current page number. $CI =& get_instance(); + // See if we are using a prefix or suffix on links if ($this->prefix != '' OR $this->suffix != '') { - $this->cur_page = str_replace(array($this->prefix, $this->suffix), '', $CI->uri->segment($this->uri_segment)); + $this->cur_page = (int) str_replace(array($this->prefix, $this->suffix), '', $CI->uri->segment($this->uri_segment)); } if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE) @@ -154,7 +155,7 @@ class CI_Pagination { $this->cur_page = (int) $CI->input->get($this->query_string_segment); } } - elseif ($CI->uri->segment($this->uri_segment) != $base_page) + elseif ( ! $this->cur_page AND $CI->uri->segment($this->uri_segment) != $base_page) { $this->cur_page = (int) $CI->uri->segment($this->uri_segment); } @@ -165,7 +166,7 @@ class CI_Pagination { $this->cur_page = $base_page; } - $this->num_links = (int)$this->num_links; + $this->num_links = (int) $this->num_links; if ($this->num_links < 1) { -- cgit v1.2.3-24-g4f1b