Php paging function multi () discuz. The code for copying the code is as follows: ** paging function ** $ num total number of items, $ perpage: how many items per page, $ curpage current page, $ mpurlurl, $ page10: Display several pages ** functionmulti ($ num, $ per
The code is as follows:
/*
* Paging functions
* $ Num: total number of entries, $ perpage: total number of entries per page, $ curpage: current page, $ mpurl url, $ page = 10
*
*/
Function multi ($ num, $ perpage, $ curpage, $ mpurl, $ page = 10 ){
$ Multipage = '';
$ Realpages = 1;
If ($ num> $ perpage ){
$ Offset = 4;
$ Realpages = @ ceil ($ num/$ perpage );
If ($ page> $ realpages ){
$ Form = 1;
$ To = $ realpages;
} Else {
$ Form = $ curpage-$ offset;
$ To = $ form + $ page-1;
If ($ form <1 ){
$ Form = 1;
// $ To = $ curpage + 1-$ form;
If ($ to-$ form <$ page ){
$ To = $ page;
}
}
}
$ Multipage = ($ curpage> 1? 'Up ':'');
For ($ I = $ form; $ I <= $ to; $ I ++ ){
$ Multipage. = $ I ==$ curpage? ''. $ I .'':
''. $ I .'';
}
$ Multipage. = $ curpage <$ realpages? 'Next ':'';
$ Multipage = $ multipage? '
'. $ Multipage .'
':'';
}
Return $ multipage;
}
The http://www.bkjia.com/PHPjc/320168.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/320168.htmlTechArticle code is as follows:/** paging function * $ num total number of entries, $ perpage one page, $ curpage current page, $ mpurl url, $ page = 10 display several pages **/function multi ($ num, $ per...