CI paging class, how to display the number (page, next page, home, last) for the picture display it?

Source: Internet
Author: User
Tags rtrim codeigniter
CI Paging

CI paging class, how to display the number (page, next page, home, last) for the picture display it?
For example, this form


Reply to discussion (solution)

Find text, change to IMG tag

Find text, change to IMG tag

Concrete How to change, please pointing pointing!!!
 '; var $cur _tag_close= ' ' var $next _tag_open= '; var $next _tag_close= '; var $prev _tag_open= '; var $prev _tag_close= '; var $num _tag_open= '; var $num _tag_close= '; var $page _query_string= false;var $query _string_segment = ' per_page '; var $display _pages= TRUE; var $anchor _class= ';/** * Constructor * * @accesspublic * @paramarrayinitialization parameters */public function __const Ruct ($params = Array ()) {if (count ($params) > 0) {$this->initialize ($params);} if ($this->anchor_class! = ") {$this->anchor_class = ' class= '. $this->anchor_class. '" ';} Log_message (' Debug ', ' Pagination Class Initialized ');} --------------------------------------------------------------------/** * Initialize Preferences * * @accesspublic * @paramarrayinitialization Parameters * @returnvoid */function Initialize ($params = Array ()) {if (count ($params) > 0) { foreach ($params as $key = + $val) {if (Isset ($this-$key)) {$this, $key = $val;}}} // --------------------------------------------------------------------/** * Generate the pagination links * * @accesspublic * @returnstring */function create_links () {//If our item count or Per-pag E Total is zero there are no need to continue.if ($this->total_rows = = 0 OR $this->per_page = = 0) {return ';} Calculate the total number of pages$num_pages = Ceil ($this->total_rows/$this->per_page);//Is there only one PA Ge? Hm ... Nothing more to does here Then.if ($num _pages = = 1) {return ';} Set the base page index for starting page Numberif ($this->use_page_numbers) {$base _page = 1;} else{$base _page = 0;} Determine the current page number. $CI =& get_instance (); if ($CI->config->item (' enable_query_strings ') = = = True OR $this->page_query_string = = = True) {if ($CI->input->get ($this->query_string_segment)! = $base _page {$this->cur_page = $CI->input->get ($this->query_string_segment);//Prep the current page-no funny business! $this->cur_page = (int) $this->cur_page;}} Else{if ($CI->uri->segment ($this->uri_segment)! = $base _page) {$this->cur_page = $CI->uri->segment ($this->uri_segment);//Prep The current page -No funny business! $this->cur_page = (int) $this->cur_page;}} Set current page to 1 if using page numbers instead of Offsetif ($this->use_page_numbers and $this->cur_page = = 0 {$this->cur_page = $base _page;}  $this->num_links = (int) $this->num_links;if ($this->num_links < 1) {Show_error (' Your number of links must be a Positive number. ');} if (! is_numeric ($this->cur_page)) {$this->cur_page = $base _page;} is the page number beyond the result range?//if and we show the last Pageif ($this->use_page_numbers) {if ($this Cur_page > $num _pages) {$this->cur_page = $num _pages;}} Else{if ($this->cur_page > $this->total_rows) {$this->cur_page = ($num _pages-1) * $this->per_page;}} $uri _page_number = $this->cur_page;if (! $this->use_page_numbers) {$this->cur_page = floor ($this->cur_ page/$this->per_page) + 1);} Calculate the start and end numbers. These determine//which number to start and end the digit links With$start = (($this->cur_page-$this->num_links) & Gt 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;//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 Neededif ($CI->config->item (' enable_query_strings ') = = = TRUE OR $th is->page_query_string = = = TRUE) {$this->base_url = RTrim ($this->base_url). ' & '. $this->query_string_segment. ' =';} else{$this->base_url = RTrim ($this->base_url, '/'). ' /';}  And here we go ... $output = ";//Render the" first "Linkif ($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-&GT;first_tag_open. ' Anchor_class. ' href= '. $first _url. ' " > '. $this->first_link. $this->first_tag_close;} Render the "previous" Linkif ($this->prev_link!== FALSE and $this->cur_page! = 1) {if ($this->use_page_number s) {$i = $uri _page_number-1;} else{$i = $uri _page_number-$this->per_page;} if ($i = = 0 && $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; $output. = $this->prev_tag_open. ' Anchor_class. ' href= '. $this->base _url. $i. ' > ' $this->prev_link. '. $this->prev_tag_close;}} Render the Pagesif ($this->display_pages!== FALSE) {//Write the digit linksfor ($loop = $start-1; $loop <= $end ; $loop + +) {if ($this->use_page_numbers) {$i = $loop;} else{$i = ($loop * $this->per_page)-$this->per_page;} if ($i >= $base _page) {if ($this->cur_page = = $loop) {$OUTPUT. = $this->cur_tag_open. $loop. $this->cur_tag_close; Current page}else{$n = ($i = = $base _page)? ": $i, if ($n = =" && $this->first_url! = ") {$output. = $this->num_tag_open. ' Anchor_class. ' href= '. $this ->first_url. ' " > '. $loop. $this->num_tag_close;} else{$n = ($n = = ")? ": $this->prefix. $n. $this->suffix; $output. = $this->num_tag_open. ' Anchor_class. ' href= '. $this->base_ URL. $n. ' > '. $loop. '. $this->num_tag_close;}}}} Render the "Next" Linkif ($this->next_link!== FALSE and $this->cur_page < $num _pages) {if ($this->use_page_ Numbers) {$i = $this->cur_page + 1;} else{$i = ($this->cur_page * $this->per_page);} $output. = $this->next_tag_open. ' Anchor_class. ' href= '. $this->base_url. $this->prefix. $i. $this. suffix. ' " > '. $this->next_link. $this->next_tag_close;} Render the "Last" Linkif ($this->last_link!== FALSE and ($this->cur_page + $this->num_links) < $num _pages) {if ($this->use_page_numbers) {$i = $num _pages;} else{$i = (($num _pages * $this->per_page)-$this->per_page);} $output. = $this->last_tag_open. ' Anchor_class. ' href= '. $this->base_url. $this->prefix. $i. $this. suffix. ' " > '. $this->last_link. $this->last_tag_close;}  Kill double slashes. Note:sometimes we can end up with a double slash//in the penultimate link so we'll kill all double slashes. $output = Pre G_replace ("# ([^:])//+#", "\\1/", $output);//ADD the wrapper HTML if Exists$output = $this->full_tag_open. $output. $ This->full_tag_close;return $output;}} End pagination class/* end of file pagination.php *//* location:./system/libraries/pagination.php */

You find where the page is, change it.
Other similarities

After replacing the $output, return

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.