Home >Backend Development >PHP Tutorial >Discuss the specific application of PHP paging navigation function_PHP tutorial

Discuss the specific application of PHP paging navigation function_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:32:13956browse

What we introduce to you today is the code example of

PHP paging navigation function:

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

CSS style of PHP paging navigation function:

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

The above is the specific implementation code of PHP paging navigation function.


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446152.htmlTechArticleWhat we introduce to you today is a code example of PHP paging navigation function: functionyl_list_page($pageurl,$rsnum, $pages,$pagecount,$pagesize){ //$ pageurl = '?' ; $ pcount =$p...