Implement processing of 10 pages and 10 pages after 10 pages

Source: Internet
Author: User
& Lt ;? * Display data records by page a page with 10 consecutive pages connected to one page can display $ limit_row record information with the following 10 pages and top 10 pages turning functions ------ required input value $ total_row; $ limit_row; $ pagename; ----- $ tot /* ==== Display data records by page ====
A page has ten consecutive page connections
$ Limit_row record information is displayed on one page.
It also has the following 10 pages and top 10 pages flip function
==========================================

------ Value $ total_row; $ limit_row; $ pagename ;-----
$ Total_row indicates the total number of rows in the selected query results.
$ Limit_row indicates the maximum number of lines displayed on each page.
$ Pagename indicates the name of the returned display page. (Without suffix)
----------------------------------------------------

----------------------------------------------------
$ Page current read page
$ Total_page can be divided into several pages.
$ Row_begin indicates the number of rows to read.
$ Row_end indicates the number of rows read.
-----------------------------------------------------*/

If (! $ Page) {$ page = 1 ;}
$ Total_page = ceil ($ total_row/$ limit_row );
$ Row_begin = $ limit_row * ($ page-1 );
If ($ page = $ total_page & ($ total_row % $ limit_row )){
$ Read_row = ($ total_row % $ limit_row );
} Else {$ read_row = $ limit_row ;}
If ($ total_page <= 10 ){
$ Page_begin = 0;
$ Page_end = $ total_page;
$ Page10 = 1;
$ Newpage10 = 1;
} Else {
// -------------- Display the next 10 pages by page ----------------
// $ Page10 contains dozens of pages in total
// $ Newpage10 is the starting position for reading ten pages
// $ Page_endx indicates the last page number to be read.

$ Page10 = ceil ($ total_page/10 );
If ($ newpage10 = "") {$ newpage10 = 1 ;}
$ Page_begin = 10 * ($ newpage10-1 );
If ($ newpage10 = 1)
{
If ($ newpage10 ==( $ page10-1) & ($ total_page % 10 ))
{
$ Page_endx = $ total_page % 10;
$ Page_end = 10;
Echo "| top 10 pages | page $ page_endx | ";
} Else {
$ Page_end = 10;
Echo "| the top 10 pages | the next 10 pages | ";
}
} Elseif ($ newpage10> 1 ){
If ($ newpage10 === page10 & ($ total_page % 10 ))
{$ Page_end = $ total_page % 10;
Echo "| top 10 pages | the last $ page_end page | ";
} Else {
If ($ newpage10 ==( $ page10-1) & ($ total_page % 10 ))
{$ Page_endx = $ total_page % 10;
$ Page_end = 10;
Echo "| top 10 pages | page $ page_endx | ";
} Else {
$ Page_end = 10;
Echo "| top 10 pages | Next 10 pages | ";
}
}

}
}

// ---------------------- Page number per ten pages --------------------------------------
Echo "total:". $ total_row. "entry ";
For ($ n = $ page_begin + 1; $ n <= $ page_begin + $ page_end; $ n ++ ){
Echo "$ n ";
}
Echo "page ";

?>

Related Article

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.