Just wrote the page-function _php Tutorial

Source: Internet
Author: User
Just wrote the paging function
Workaround
Originally wanted to find a paging function or class used to be, the results of online search for a long time nothing easy to use. I took 10 minutes to finish a page. Very simple, to give you a comment .... (later looked a bit like Google and Baidu ...) /* Paging function

$num: How many articles in total

$p: Current page number

$q: what's currently being searched for

$STR: Address URL parameter (something behind the question mark)

$PN: Number of displays 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 = $p 7; $i < $p +7;++ $i)

{

if ($i >0 && $i <= $ps)

Echo '. $i. '):(' page ' > '. $i. ') ';

}

if ($p! = $ps)

Echo ' next page ';

}


Copy the code below is, hehe








[ ]
Attachments: The user group you are in cannot download or view attachments

d8888d Huitie Content
Look at the page class that the old ghost has written.

[url=http://bbs.phpchina.com/viewthread.php?tid=29479&highlight=%b7%d6%d2%b3] link marker http://bbs.phpchina.com/ Viewthre ... hlight=%b7%d6%d2%b3[/url]
d8888d Huitie Content
Look, a word length
The ability to quickly implement the function is OK
d8888d Huitie Content
I use the <> icon on the editor to see only a couple of [code] tags at the end of the code.
d8888d Huitie Content
Thank you, sir.
d8888d Huitie Content
Thanks for sharing, @!.
d8888d Huitie Content
It's all used.
^_^
[Img]http://www.phpchina.com/bbs/images/smilies/default/lol.gif[/img]

http://www.bkjia.com/PHPjc/632524.html www.bkjia.com true http://www.bkjia.com/PHPjc/632524.html techarticle just write the paging function solution originally wanted to find a paging function or class use is, the results of the Internet for a long time nothing easy to use. I took 10 minutes to finish a page. Very simple .

  • 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.