God help me to see, my query paging class where the wrong page class
This is page.class.php.
Class dividepage{//Pagination Classes
private $total;//The total number of records to display
private $url;//URL of the requested address
private $DISPLAYPG;//The number of records displayed per page, by default 10 records per page
private $page;//Current page
private $LASTPG;//Total pages, or page number of the last page
private $PREPG;//Previous Page
private $NEXTPG;//Next page
private $firstcount;//The starting number of the record bar starts at 0
private $STARTD;//record number at the beginning of the record bar.
private $stopd;//record number at the end of the record number.
constructor function
Public function __construct ($url, $total, $DISPLAYPG) {
$this->url = $url;//URL of the request
$this->total = $total;//Total Record Count
if ($DISPLAYPG = = ")
$this->DISPLAYPG = $DISPLAYPG;//The number of records displayed per page
$this->initdividepage ();//Initialize page-Paging class
Echo ', '. $this->displaypg;
}
Initializing the Paging class
Private Function Initdividepage () {
Parsing URLs
$parse _url = Parse_url ($this->url);//The URL is interpreted as an array with fixed key-value pairs
$url _query = $parse _url[' query '];//take out the query string in the URL
if ($url _query) {//If there is a query string, delete the query field for the current page in the query strings such as: &page= $page or page= $page
Ereg (' (^|&) page= ([0-9]*) ', $url _query, $k);
$this->page = $k [2];//Gets the value of the current page
$url _query = ereg_replace ("(^|&) page= $this->page", ", $url _query);//delete the query field of the current page in the query string such as: &page= $page or page= $page
$this->url = str_replace ($parse _url[' query '], $url _query, $this->url);//Keep other query strings,
$this->page = $this->page? $this->page:1;//If the value of the current page is not in the query string, the current page is set to 1
if ($url _query) {//If there are other query strings, add a page-up query string in &page= $page form
$this->url. = ' &page ';
}else{//If there are no additional query strings, add a page-up query string in the form of page= $page
$this->url. = ' page ';
}
}else{//If there is no query string, add it after the URL? page= $page form of page-turn query string
$this->page = 1;
$this->url. = '? page ';
}
$this->LASTPG = ceil ($this->total/$this->displaypg);//Calculate the total number of pages, that is, the last page
$this->page = min ($this->lastpg, $this->page);//If the current page is greater than the total number of pages, the current page is the last page
$this->PREPG = $this->page-1;//Previous page minus one for the current page
$this->NEXTPG = $this->page + 1;//(($this->page = = $this->lastpg)? $this->lastpg: ($this->page + 1)); /next page for the current page plus one, if the current page is the last page, the next page is 0
$this->firstcount = ($this->page-1) * $this->displaypg;//calculates the current page, the record number of the record number, starting at 0.
$this->STARTD = $this->total? ($this->firstcount + 1): 0;//record start number starting from 1
$this->stopd = min ($this->firstcount + $this->displaypg, $this->total);//Record End number
Echo $this->displaypg;
echo $this->nextpg. ' +=+= '. $this->lastpg;
}
Public Function GetPageInfo () {//Gets the basic information of the current page, such as: Display 第1-10条 record, total 23 records.
Return 'showing the " . $this->startd. '-' $this->stopd. ' Records, Total '. $this->total. ' Record. ';
}
Public Function Getcommonpagenav () {//Gets the usual paging navigation, such as: Home previous next last page
$commonnav = ";
if ($this->lastpg = = 1) {//If there is only one page, then return to flip Navigation, exit, do not display next page, previous page, etc...
return $commonnav;
Break
}
$commonnav = ' URL. ' =1 "class=" Compagestyle "> Home";//Set home navigation, page=1
if ($this->prepg) {
$commonnav. = ' URL. ' = '. $this->prepg. ' "class=" Compagestyle "> Previous page";
}else{