Implementation of 10 pages of forward 10 pages backward 10 pages of processing

Source: Internet
Author: User
Keywords Implementation of 10 pages of forward 10 pages backward 10 pages of processing
/*==== the record of the data is paginated =====
A page that has a contiguous 10-page connection
One page to display $limit_row record information
and has the next 10 page and the 10 page paging function
===================================

------need to pass in value $total_row; $limit _row; $pagename;-----
$total _row The total number of rows for the selected query result
$limit _row The maximum number of rows to display per page
$pagename Displays the page name for the return. (without suffix name)
----------------------------------------------------

----------------------------------------------------
$page the currently read page
$total _page can be divided into several pages.
$row _begin to start reading from the first few lines
$row _end to read the first line
-----------------------------------------------------*/

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;
$page 10=1;
$newpage 10=1;
}else{
--------------page shows the next 10 pages----------------
$page 10 for a total of a few 10 pages
$newpage 10 is the starting position for reading 10 pages
$page _endx to read the last page

$page 10=ceil ($total _PAGE/10);
if ($newpage ten = = "") {$newpage 10=1;}
$page _begin=10* ($newpage 10-1);
if ($newpage 10==1)
{
if ($newpage 10== ($page 10-1) && ($total _page%10))
{
$page _endx= $total _page%10;
$page _end=10;
echo "| Top 10 Pages | Next $page _endx page | ";
}else{
$page _end=10;
echo "| is the top 10 page | Next 10 pages | ";
}
}elseif ($newpage 10>1) {
if ($newpage 10== $page 10&& ($total _page%10))
{$page _end= $total _page%10;
echo "| Top 10 Pages | is the last $page _end | ";
}else{
if ($newpage 10== ($page 10-1) && ($total _page%10))
{$page _endx= $total _page%10;
$page _end=10;
echo "| Top 10 Pages | Next $page _endx page | ";
} else{
$page _end=10;
echo "| Top 10 Pages | Next 10 pages | ";
}
}

}
}

----------------------page numbers per 10 pages--------------------------------------
echo "Total:" $total _row. " section ";
for ($n = $page _begin+1; $n <= $page _begin+ $page _end; $n + +) {
echo "$n";
}
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.