A quick and easy-to-use php paging class-php Tutorial

Source: Internet
Author: User
A quick and easy-to-use php paging class
[Code]

Totalpage = $ objpage;} // set the current page function setCurrentpage ($ objpage = 1) {$ this-> currentpage = $ objpage ;} // Set the span function setStride ($ objStride = 1) {$ this-> stride = $ objStride;} // obtain the total page number function getTotalpage () {return $ this-> totalpage;} // Obtain the cross-read function getStride ($ objStride = 1) {return $ this-> stride ;} // Obtain the function getCurrentpage ($ objpage = 1) {return $ this-> currentpage;} // Print the public function Pageprint () {for ($ Tmpa = 1; $ Tmpa <= $ this-> totalpage; $ Tmpa ++) {if ($ Tmpa + $ this-> stride <$ this-> currentpage) {// if ($ Tmpa + $ this-> stride ==$ this-> currentpage) {// The number of pages in the span. $ p = $ this-> currentpage-1; $ willprint. = "homepage previous page";} if ($ Tmpa> $ this-> currentpage + $ this-> stride) {// The break of the page larger than the current page and span;} $ willprint. = "[$ Tmpa]"; if ($ Tmpa = $ this-> currentpage + $ this-> stride) {// The number of pages in the span. $ p = $ this-> currentpage + $ this-> stride + 1; $ willprint. = "Next totalpage \"> last page ";}} echo $ willprint ;}}

Class cut_page extends Page {var $ filename; var $ showtotal; function _ construct ($ filename) {$ this-> cachefile = $ filename; $ this-> showtotal = "yes";} public function filename () {if (file_exists ($ this-> cachefile) {return 1;} else return 0 ;} private $ type; public function typelist ($ typeid) {$ this-> type = $ typeid; $ fp = fopen ($ this-> cachefile, "rb "); $ str = fread ($ fp, filesize ($ this-> cachefile); // echo $ this-> type."
"; // Category ID $ arr = explode (": ", $ str );

For ($ I = 0; $ I Type) {// return $ arr2 [1]; if (isset ($ _ GET

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.