Ec (2); php classic paging supports 10 codes & nbsp; + ------------------------------------------------- & nbsp; | & nbsp; Autohr & nbsp ;: & nbsp; jimmy & nbsp; | & nbsp; Email & nbsp;: & nbsp; mailangel123@163.com & nbsp; | & nbs script ec (2); script
Php classic paging supports 10 Code on 10 pages
+ -------------------------------------------
|
| Autohr: jimmy
| Mail: mailangel123@163.com
|
+ -------------------------------------------
*/
/*
+ -------------------------------------------
+ Page unavailable
+ -------------------------------------------
*/
If (@! $ Perpage |! Is_numeric (@ $ perpage) | @ $ perpage <= 0 ){
$ Perpage = 20;
}
/*
+ -------------------------------------------
+ Collect the total data records of the maximum page tds record
+ -------------------------------------------
*/
$ Pages = ceil ($ tds/$ perpage );
/*
+ -------------------------------------------
+ Maximum statistics page
+ -------------------------------------------
*/
$ Page = $ page> $ pages? $ Pages: $ page;
$ Page = is_numeric ($ page) & $ page> 0? Ceil ($ page/1): 1;
/*
+ -------------------------------------------
+ How many records are retrieved?
+ -------------------------------------------
*/
$ Pages_limit = ($ page-1) * $ perpage;
$ Pages_offset = $ perpage;
/*
+ -------------------------------------------
+ Start page and end page
+ -------------------------------------------
*/
If ($ pages <= 10 ){
$ Spage = 1;
$ Epage = $ pages;
} Else {
If ($ page> $ pages-5 ){
$ Spage = $ pages-9;
$ Epage = $ pages;
} Elseif ($ page <6 ){
$ Spage = 1;
$ Epage = 10;
} Else {
$ Spage = $ page-4;
$ Epage = $ page + 5;
}
}
/*
+ -------------------------------------------
+ Previous and next pages
+ -------------------------------------------
*/
$ Pages_prev = $ page <= 2? 1: ($ page-1 );
$ Pages_next = $ page >=$ pages-1? $ Pages: ($ page + 1 );