Php simple paging class | page. class. php-PHP source code

Source: Internet
Author: User
Php simple paging class | page. class. php simple and easy to use PHP paging class

 2) {$ url = self: url (1); return"
  • Homepage
  • ";}} Public static function previous () {if (self: $ page> 1) {$ url = self: url (self: $ page-1 ); return"
  • Previous Page
  • ";}} Public static function number () {$ str =''; $ f = self: $ number % 2? (Self: $ number-1)/2: self: $ number/2; $ s = self: $ page-$ f; $ e = self :: $ page + $ f; if (self: $ page <($ f + 1) {$ s = 1; $ e = self: $ number; $ e = $ e> self: $ max? Self: $ max: $ e;} if (self: $ page> (self: $ max-$ f) {$ s = self :: $ max-self: $ number; $ s = $ s <1? 1: $ s; $ e = self: $ max;} for ($ I = $ s; $ I <= $ e; $ I ++) {$ url = self: url ($ I); if ($ I = self: $ page) $ str. ="
  • {$ I}
  • "; Else $ str. ="
  • {$ I}
  • ";}Return $ str;} public static function next () {if (self ::$ page <self ::$ max) {$ url = self :: url (self:: $ page + 1); return"
  • Next page
  • ";}} Public static function end () {if (self: $ max-self: $ page)> 1) {$ url = self: url (self:: $ max); return"
  • Last page
  • ";}} Public static function url ($ page) {return str_replace ('{page}', $ page, self: $ url );}}

    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.