Php paging function multi () discuz_PHP tutorial

Source: Internet
Author: User
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...

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.