Home > php教程 > php手册 > body text

探讨PHP分页导航函数的具体应用

WBOY
Release: 2016-06-13 11:09:15
Original
1456 people have browsed it

我们今天为大家介绍的是有关

PHP分页导航函数的代码示例:

  1. function yl_list_page($pageurl,$rsnum,
    $pages,$pagecount,$pagesize){   
  2. //$pageurl='?';   
  3. $pcount = $pages;   
  4. $page_info = '';   
  5. $page_info .'';   
  6. if (($pcount > 1) && ($pcount == $pagecount) ){   
  7. $page_info .'.$pageurl.
    '
    page='.intval($pagecount-1).'>上一页 /a>';   
  8. }elseif (($pagecount != 1) && ($pcount != $pagecount)){   
  9. $page_info .'.$pageurl.'page='.intval($pagecount-1).'>上一页 /a>';   
  10. }   
  11. $page_info .'.$pageurl.'page=1>页首 /a>';   
  12. if ($pagecount > 4){   
  13. $page_info .'.$pageurl.'page=1>[1] /a>span class=dot>... /span>';   
  14. }   
  15. if ($pcount > $pagecount+2){   
  16. $endpage = $pagecount+2;   
  17. }else{   
  18. $endpage = $pcount;   
  19. }   
  20. for ($n = ($pagecount-2); $n  = $endpage; $n++){   
  21. if (!($n  1)){   
  22. if ($n == intval($pagecount)){   
  23. $page_info .''.$n.' /span>';   
  24. }else{   
  25. $page_info .'.$pageurl.'page='.$n.'>['.$n.'] /a>';   
  26. }   
  27. }   
  28. }   
  29. if ($pagecount+2  $pcount){   
  30. $page_info .'....$pageurl.'page='.$pcount.'>['.$pcount.'] /a>';   
  31. }   
  32. $page_info .'.$pageurl.'page='.$pcount.'>页尾 /a>';   
  33. if (($pagecount == 1) && ($pcount != $pagecount) && ($pcount != 0)){   
  34. $page_info .'.$pageurl.'page='.intval($pagecount + 1).'>下一页 /a>';   
  35. }else if (($pagecount != 1) && ($pcount != $pagecount)){   
  36. $page_info .'.$pageurl.'page='.intval($pagecount + 1).'>下一页 /a>';   
  37. }   
  38. $page_info .'';   
  39. $page_info .'';   
  40. $page_info .' 共:'.$rsnum .'条/'.$pcount.'页 每页/'.$pagesize.'条 /span>div>';   
  41. $page_info .' ';   
  42. //echo ' form name=page action='.$pageurl.'>';   
  43. $page_info .' 转到';   
  44. $page_info .= ' input type=text name=page value='1class=login_left style='width:28px;height:18px;'>';   
  45. $page_info .= '页 input type=submit name=submit3 class=login_submit style='width:28px;height:18px;padding-top:1px;' onclick=document.myform.action.value='go'> ';   
  46. //echo ' /form>';   
  47. $page_info .'';   
  48. $page_info .'';   
  49. return $page_info;   
  50. }  

PHP分页导航函数的CSS样式:

<ol class="dp-xml">
<li class="alt"><span><span>/*page*/   </span></span></li>
<li><span>.pagenum {   </span></li>
<li class="alt"><span>clear: both; width: '100%';</span></li>
<li class="alt"><span>padding-right: 5px; </span></li>
<li class="alt"><span>padding-left: 0px; </span></li>
<li class="alt"><span>font-weight: bold; </span></li>
<li class="alt"><span>padding-bottom: 0px; </span></li>
<li class="alt"><span>overflow: hidden; </span></li>
<li class="alt"><span>color: #6396d6; </span></li>
<li class="alt"><span>padding-top: 0px; </span></li>
<li class="alt"><span>height: 25px;   </span></li>
<li><span>}   </span></li>
<li class="alt"><span>.pagenum .num {   </span></li>
<li><span>float: right;   </span></li>
<li class="alt"><span>}   </span></li>
<li><span>.pagenum .normal {   </span></li>
<li class="alt"><span>background: #f7fbff;color: #6396d6;</span></li>
<li class="alt"><span> float: left; </span></li>
<li class="alt"><span>padding-bottom: 2px; </span></li>
<li class="alt"><span>margin: 0px 3px 0px 0px; </span></li>
<li class="alt"><span>padding-top: 3px;</span></li>
<li class="alt"><span>border-left: #6396d6 1px solid; </span></li>
<li class="alt"><span>border-right: #6396d6 1px solid;</span></li>
<li class="alt"><span>padding-right: 5px;</span></li>
<li class="alt"><span> padding-left: 5px; </span></li>
<li class="alt"><span>border-top: #6396d6 1px solid;</span></li>
<li class="alt"><span>border-bottom: #6396d6 1px solid;   </span></li>
<li><span>}   </span></li>
<li class="alt"><span>.pagenum .dot {   </span></li>
<li><span>float: left;color: #6396d6;   </span></li>
<li class="alt"><span>}   </span></li>
<li><span>.pagenum a {   </span></li>
<li class="alt"><span>background: #298ac6; </span></li>
<li class="alt"><span>color: #fff; </span></li>
<li class="alt"><span>float: left;</span></li>
<li class="alt"><span> padding-bottom: 2px; </span></li>
<li class="alt"><span>margin: 0px 3px 0px 0px; </span></li>
<li class="alt"><span>padding-top: 3px;</span></li>
<li class="alt"><span>border-left: #6396d6 1px solid;</span></li>
<li class="alt"><span> border-right: #6396d6 1px solid;</span></li>
<li class="alt"><span>padding-right: 5px; </span></li>
<li class="alt"><span>padding-left: 5px; </span></li>
<li class="alt"><span>border-top: #6396d6 1px solid;</span></li>
<li class="alt"><span>border-bottom: #6396d6 1px solid;   </span></li>
<li><span>}   </span></li>
<li class="alt"><span>.pagenum a:visited {   </span></li>
<li><span>color: #fff;   </span></li>
<li class="alt"><span>}   </span></li>
<li><span>.pagenum a:hover {   </span></li>
<li class="alt"><span>background: #f7fbff;color: #6396d6;</span></li>
<li class="alt"><span>border-left: #6396d6 1px solid; </span></li>
<li class="alt"><span>border-right: #6396d6 1px solid;</span></li>
<li class="alt"><span>border-top: #6396d6 1px solid;</span></li>
<li class="alt"><span>border-bottom: #6396d6 1px solid;   </span></li>
<li><span>}   </span></li>
</ol>
Copy after login

以上就是 PHP分页导航函数的具体实现代码。


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!