The novice asks a paging class for an output loop that shows the paging encounters problems, solves

Source: Internet
Author: User
Novice question one output cycle of the paging class shows that the page is experiencing problems solving?

Class Pageclass {
Private $total _record;//Total records
Private $page _size;//page record Count
Private $current _page;//Current page
Private $total _page_size;//Total pages
Private $page _url; Page URL
Private $page _start; Start Page
Private $page _stop;//End page
Public $page _limit; Limit
function __construct ($total _record=0, $page _size=1, $current _page=1, $page _url) {
$this->total_record= $this->numeric ($total _record);
$this->page_size= $this->numeric ($page _size);
$this->current_page= $this->numeric ($current _page);
$this->page_limit= ($this->current_page* $this->page_size)-$this->page_size;
$this->page_url= $page _url;
if ($this->current_page<1) {
$this->current_page=1;
}

if ($this->current_page<0) {
$this->current_page=0;
}
$total _page_size = ceil ($total _record/$page _size);

if ($this->total_page_size<1) {
$this->total_page_size=1;
}
if ($this->current_page> $this->total_page_size) {
$this->crrent_page= $this->total_page_size;
}
$this->page_start= $this->current_page;
$this->page_stop= $this->current_page+5;
if ($this->page_stop> $this->total_page_size) {
$this->page_stop= $this->total_page_size;
$this->page_start= $this->page_stop-5;
}
if ($this->page_start<1) {
$this->page_start=1;
if ($this->page_stop > $this->total_page_size) {
$this->page_stop= $this->total_page_size;
}
  • 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.