diff options
Diffstat (limited to 'system/libraries')
-rw-r--r-- | system/libraries/Pagination.php | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index ccd3e8261..68c35a57e 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -56,6 +56,7 @@ class CI_Pagination { var $num_tag_close = ''; var $page_query_string = FALSE; var $query_string_segment = 'per_page'; + var $anchor_class = ''; /** * Constructor @@ -70,6 +71,11 @@ class CI_Pagination { $this->initialize($params); } + if ($this->anchor_class != '') + { + $this->anchor_class = 'class="'.$this->anchor_class.'" '; + } + log_message('debug', "Pagination Class Initialized"); } @@ -187,25 +193,25 @@ class CI_Pagination { $output = ''; // Render the "First" link - if ($this->cur_page > ($this->num_links + 1)) + if ($this->first_link !== FALSE AND $this->cur_page > ($this->num_links + 1)) { $first_url = ($this->first_url == '') ? $this->base_url : $this->first_url; - $output .= $this->first_tag_open.'<a href="'.$first_url.'">'.$this->first_link.'</a>'.$this->first_tag_close; + $output .= $this->first_tag_open.'<a '.$this->anchor_class.'href="'.$first_url.'">'.$this->first_link.'</a>'.$this->first_tag_close; } // Render the "previous" link - if ($this->cur_page != 1) + if ($this->prev_link !== FALSE AND $this->cur_page != 1) { $i = $uri_page_number - $this->per_page; if ($i == 0 && $this->first_url != '') { - $output .= $this->prev_tag_open.'<a href="'.$this->first_url.'">'.$this->prev_link.'</a>'.$this->prev_tag_close; + $output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'">'.$this->prev_link.'</a>'.$this->prev_tag_close; } else { $i = ($i == 0) ? '' : $this->prefix.$i.$this->suffix; - $output .= $this->prev_tag_open.'<a href="'.$this->base_url.$i.'">'.$this->prev_link.'</a>'.$this->prev_tag_close; + $output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$i.'">'.$this->prev_link.'</a>'.$this->prev_tag_close; } } @@ -227,29 +233,29 @@ class CI_Pagination { if ($n == '' && $this->first_url != '') { - $output .= $this->num_tag_open.'<a href="'.$this->first_url.'">'.$loop.'</a>'.$this->num_tag_close; + $output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'">'.$loop.'</a>'.$this->num_tag_close; } else { $n = ($n == '') ? '' : $this->prefix.$n.$this->suffix; - $output .= $this->num_tag_open.'<a href="'.$this->base_url.$n.'">'.$loop.'</a>'.$this->num_tag_close; + $output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$n.'">'.$loop.'</a>'.$this->num_tag_close; } } } } // Render the "next" link - if ($this->cur_page < $num_pages) + if ($this->next_link !== FALSE AND $this->cur_page < $num_pages) { - $output .= $this->next_tag_open.'<a href="'.$this->base_url.$this->prefix.($this->cur_page * $this->per_page).$this->suffix.'">'.$this->next_link.'</a>'.$this->next_tag_close; + $output .= $this->next_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$this->prefix.($this->cur_page * $this->per_page).$this->suffix.'">'.$this->next_link.'</a>'.$this->next_tag_close; } // Render the "Last" link - if (($this->cur_page + $this->num_links) < $num_pages) + if ($this->last_link !== FALSE AND ($this->cur_page + $this->num_links) < $num_pages) { $i = (($num_pages * $this->per_page) - $this->per_page); - $output .= $this->last_tag_open.'<a href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->last_link.'</a>'.$this->last_tag_close; + $output .= $this->last_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->last_link.'</a>'.$this->last_tag_close; } // Kill double slashes. Note: Sometimes we can end up with a double slash |