How should I change the encapsulated paging function to this effect?

Source: Internet
Author: User
I don't want to display all the pages to show only five or ten pages. How can I change this code? {Code...} I don't want to display all the pages only five or ten pages. How should I change this code?

 "; Echo"
 
 
    "; Echo'
  • '. $ Page.'/'. $ pagenum.' page |
  • '; If ($ page = 1) {echo'
  • Homepage |
  • '; Echo'
  • Previous Page |
  • ';} Else {echo'
  • Homepage |
  • '; Echo'
  • Previous Page |
  • ';} Echo'

    '; Echo'

      '; For ($ I = 0; $ I <$ pagenum; $ I ++) {echo'
    • '. ($ I + 1 ).'
    • ';} Echo'
    '; Echo'

    '; If ($ page = $ pagenum) {echo'
  • | Next page |
  • '; Echo'
  • Last page |
  • ';} Else {echo'
  • | Next page |
  • '; Echo'
  • Last page |
  • ';} Echo'
'; Echo'

';};?>

Reply content:

 "; Echo"
 
 
    "; Echo'
  • '. $ Page.'/'. $ pagenum.' page |
  • '; If ($ page = 1) {echo'
  • Homepage |
  • '; Echo'
  • Previous Page |
  • ';} Else {echo'
  • Homepage |
  • '; Echo'
  • Previous Page |
  • ';} Echo'

    '; Echo'

      '; $ Fp = ($ page-1) * $ dp + 1; // how many pages are displayed for $ dp = 3: homepage previous 1 2 3 next last page; // or $ dp = 8: homepage previous 1 2 3 4 5 6 7 8 next last page // $ fp: indicates the number of pages to be displayed. $ ep = $ fp + $ dp; // $ ep: indicates the number of pages to be displayed. for ($ I = $ fp; $ I <= $ pagenum; $ I ++) {// echo'
    • '. $ I .'
    • ';} Echo'
    '; Echo'

    '; If ($ page = $ pagenum) {echo'
  • | Next page |
  • '; Echo'
  • Last page |
  • ';} Else {echo'
  • | Next page |
  • '; Echo'
  • Last page |
  • ';} Echo'
'; Echo'

';};?>


The above is the encapsulated paging function. How can this effect be changed? For more information, see the PHP Chinese website (www.php1.cn )!

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.