The newly written paging Function

Source: Internet
Author: User




The newly written paging Function
Solution
I used to find a paging function or a class. As a result, I found it easy to use online for a long time. it took me 10 minutes to get a page. it's easy to comment on .... (Later, I saw something similar to google and Baidu ....) /* Paging Functions

$ Num: Total number of articles

$ P: Current page number

$ Q: the content of the current search

$ Str: url parameter (what follows the question mark)

$ Pn: number of entries displayed per page

{Fl ($ num, $ p, $ q, $ pn )}

*/

Function fy ($ num, $ p, $ str = '? Mod = zzwla & dosubmit = 1', $ q = '', $ pn = 10)

{

If (empty ($ num) return false;

$ Ps = ceil ($ num/$ pn );

$ Q = $ q? '& Q ='. urlencode ($ q ):'';

If ($ p> 1)

Echo 'previous page ';

If ($ ps <15)

For ($ I = 1; $ I <15; ++ $ I)

{

If ($ I <= $ ps)

Echo ''. $ I.'') :( 'page "> '. $ I .'')).'';

}

Else

For ($ I = $ p7; $ I <$ p + 7; ++ $ I)

{

If ($ I> 0 & $ I <= $ ps)

Echo ''. $ I.'') :( 'page "> '. $ I .'')).'';

}

If ($ p! = $ Ps)

Echo 'Next page ';

}


Copy the following code:








[]
Attachment: you cannot download or view attachments in your user group.

D8888D reply content
Look at the paging class written by old ghost

[Url = http://bbs.phpchina.com/viewthread.php? Tid = 29479 & highlight = % B7 % D6 % D2 % B3] link tag http://bbs.phpchina.com/viewthre... hlight = % B7 % D6 % D2 % B3 [/url]
D8888D reply content
Read it. It's a long character.
You can quickly implement the function.
D8888D reply content
I use the <> icon in the editor. During preview, only one [CODE] tag is added to both ends of the CODE.
D8888D reply content
Thank you!
D8888D reply content
Thank you for sharing @!
D8888D reply content
Used
Pai_^
[Img] http://www.phpchina.com/bbs/images/smilies/default/lol.gif#/img]

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.