Implement processing of 10 pages and 10 pages after 10 pages

Source: Internet
Author: User

<?
/* ==== 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 "<font face = arial size = 2> | top 10 pages | <a href = \" $ pagename. php? Newpage10 = 2 & page = 11 \ "> page $ page_endx </A> | </FONT> ";
} Else {
$ Page_end = 10;
Echo "<font face = arial size = 2> | the top 10 pages | <a href = \" $ pagename. php? Newpage10 = 2 & page = 11 \ "> next 10 pages </A> | </FONT> ";
}
} Elseif ($ newpage10> 1 ){
If ($ newpage10 === page10 & ($ total_page % 10 ))
{$ Page_end = $ total_page % 10;
Echo "<font face = arial size = 2> | <a href = \" $ pagename. php? Newpage10 = ". ($ newpage10-1 ). "& page = ". ($ newpage10-2) * 10 + 1 ). "\"> Top 10 pages </A> | the last $ page_end page | </FONT> ";
} Else {
If ($ newpage10 ==( $ page10-1) & ($ total_page % 10 ))
{$ Page_endx = $ total_page % 10;
$ Page_end = 10;
Echo "<font face = arial size = 2> | <a href = \" $ pagename. php? Newpage10 = ". ($ newpage10-1 ). "& page = ". ($ newpage10-2) * 10 + 1 ). "\"> Top 10 pages </a> | <a href = \ "$ pagename. php? Newpage10 = ". ($ newpage10 + 1 ). "& page = ". ($ newpage10 * 10 + 1 ). "\"> page $ page_endx </A> | </FONT> ";
} Else {
$ Page_end = 10;
Echo "<font face = arial size = 2> | <a href = \" $ pagename. php? Newpage10 = ". ($ newpage10-1 ). "& page = ". ($ newpage10-2) * 10 + 1 ). "\"> Top 10 pages </A> | <a href = \ "$ pagename? Newpage10 = ". ($ newpage10 + 1 ). "& page = ". ($ newpage10 * 10 + 1 ). "\"> next 10 pages </A> | </FONT> ";
}
}

}
}

// ---------------------- Page number per ten pages --------------------------------------
Echo "Total:". $ total_row. "entry ";
For ($ n = $ page_begin + 1; $ n <= $ page_begin + $ page_end; $ n ++ ){
Echo "<a href = $ pagename. php? Newpage10 = $ newpage10 & page = $ n >$ n </a> ";
}
Echo "page ";

?>

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.