Class paging _ PHP Tutorial

Source: Internet
Author: User
Class paging. 9: 10: classPage {11: var $ firstRow0; start row 12: var $ listRows0; the number of lines in the list displayed on each page 13: var $ parameter; parameter 14 to be included during page jump: var $ total 9: 10: class Page {11: var $ firstRow = 0; // The start row 12: var $ listRows = 0; // The number of rows displayed on each Page is 13: var $ parameter = ""; // The parameter 14: var $ totalPages = 0 when the page is redirected; // the total page number is 15: var $ totalRows = 0; // total number of rows 16: var $ nowPage = 0; // Current page 17: var $ showPageJump = True; // whether to display jump to page 18: var $ coolPages = 0; // The total number of pages in the paging column 19: var $ rollPage = 5; // Number of pages displayed on each page in the pagination bar: 20: 21:/* ---------------------------------------------------------------- 22: function: display Page Information Page x total page x <6 7 8 9 10> 23: functions */24: function prompt () {25: if (0 = $ this-> totalRows) {26: return; 27:} 28: $ this-> totalPages = ceil ($ this-> totalRows/$ this-> listRows); // The total number of pages is 29: $ This-> coolPages = ceil ($ this-> totalPages/$ this-> rollPage); 30: if ($ this-> firstRow >=$ this-> totalRows) {// 17:18:29 kinger modified 31: $ this-> nowPage = $ this-> totalPages; 32: $ this-> firstRow = ($ this-> totalPages-1) * $ this-> listRows; 33:} else {34: $ this-> nowPage = floor ($ this-> firstRow/$ this-> listRows + 1 ); // Current Page No. 35:} 36: $ nowCoolPage = ceil ($ this-> nowPage/$ this-> rollPage); 37: 38: // <>>>39: if ($ nowCoolPage = 1) {40: $ theFirst = ""; 41: $ prePage = ""; 42 :} else {43: $ preRow = ($ this-> rollPage * ($ nowCoolPage-1)-1) * $ this-> listRows; 44: $ prePage = "totalRows & $ this-> parameter> <"; 45: $ theFirst = "totalRows & $ this-> parameter> <"; 46:} 47: if ($ nowCoolPage = $ this-> coolPages) {48: $ nextPage = ""; 49: $ theEnd = ""; 50:} else {51: $ nextRow = ($ nowCoolPage * $ this-> rollPage) * $ this -> ListRows; 52: $ theEndRow = ($ this-> totalPages-1) * $ this-> listRows; 53: $ nextPage = "totalRows & $ this-> parameter> "; 54: $ theEnd = "totalRows & $ this-> parameter >>>"; 55:} 56: // 1 2 3 4 5 57: $ linkPage = ""; 58: for ($ I = 1; $ I <= $ this-> rollPage; $ I ++) {59: $ page = ($ nowCoolPage-1) * $ this-> rollPage + $ I; 60: $ rows = ($ page-1) * $ this-> listRows; 61: if ($ page! = $ This-> nowPage) {62: if ($ page <= $ this-> totalPages) {63: $ linkPage. = "totalRows & $ this-> parameter> ". $ page. ""; 64:} else {65: break; 66:} 67:} else {68: if ($ this-> totalPages! = 1) {69: $ linkPage. = "[ ". $ Page ."

Limit 10: class Page {11: var $ firstRow = 0; // start row 12: var $ listRows = 0; // The number of rows in the list displayed on each Page is 13: var $ parameter =; // parameter 14: var $ total...

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.