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 .