Home  >  Article  >  Backend Development  >  PHP paging navigation function_PHP tutorial

PHP paging navigation function_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:05:18940browse

PHP paging navigation function

#******************************************** *******************
#File name: function.php
#Function description: News addition and modification processing module
#Program production: leave a print (adleyliu )
#Contact qq: 14339095
#Contact email: [email=adleyliu@163.com]adleyliu@163.com[/email]
#Official website: [url=http://www. 115000.com.cn]http://www.115000.com.cn[/url]
#copyright (c) 2007-2008 115000.com.cn all rights reserved.
#Last updated: 2007- 11-20
#****************************************** ****************


#****************************** *********************************
#Paging function
#********** ************************************************
function yl_list_page($pageurl,$rsnum,$pages,$pagecount,$pagesize){
#url
#total record
#total Number of pages
#Current page number
#Number displayed per page
//$pageurl='?';
$pcount = $pages
;
'

'; $page_info .=
'
'; if (($pcount >
1) && ($pcount == $pagecount
) ){
 $page_info .=
'Previous page'
;
}elseif (( $pagecount !=
1) && ($pcount != $pagecount
)){
      $page_info .= '.$pageurl.'page='.intval($pagecount-1).'>上一页';
   }
      
$page_info .= '.$pageurl.'page=1>页首'
;
   if (
$pagecount 4
){
     
$page_info .= '.$pageurl.'page=1>[1]...'
;
   }
   if (
$pcount $pagecount+2
){
       
$endpage $pagecount+2
;
   }else{
     
$endpage $pcount
;
   }
   for (
$n = ($pagecount-2); $n <= $endpage$n
++){
      if (!(
$n 1
)){
         if (
$n == intval($pagecount
)){
         
$page_info .= ''.$n.''
;
     }else{
        
$page_info .= '.$pageurl.'page='.$n.'>['.$n.']'
;
     }
      }
   }
   if (
$pagecount+$pcount
){
       
$page_info .= '....$pageurl.'page='.$pcount.'>['.$pcount.']'
;
   }
       
$page_info .= '.$pageurl.'page='.$pcount.'>页尾'
;
   if ((
$pagecount == 1) && ($pcount != $pagecount) && ($pcount != 0
)){
       
$page_info .= '.$pageurl.'page='.intval($pagecount 1).'>下一页'
;
   }else if ((
$pagecount != 1) && ($pcount != $pagecount
)){
       
$page_info .= '下一页'
;
   }
       
$page_info .= '
';
   
$page_info .= '
';
   
$page_info .= '
 共:'.$rsnum .'条/'.$pcount.'页 每页/'.$pagesize.'条
'
;
   
$page_info .= 
';
   
//echo '
';
   $page_info .= ' 转到'
;
   
$page_info .= ''
;
   
$page_info .= '页 '
;
   
//echo '';
   
$page_info .= '
';
   
$page_info .= '
';
      return 
$page_info
;
}

 


CSS样式:

 

/*page*/
.pagenum {
clear: both; width: '100%';padding-right: 5px; padding-left: 0px; font-weight: bold; padding-bottom: 0px; overflow: hidden; color: #6396d6; padding-top: 0px; height: 25px;
}
.pagenum .num {
float: right;
}
.pagenum .normal {
background: #f7fbff;color: #6396d6; float: left; padding-bottom: 2px; margin: 0px 3px 0px 0px; padding-top: 3px;border-left: #6396d6 1px solid; border-right: #6396d6 1px solid;padding-right: 5px;  padding-left: 5px; border-top: #6396d6 1px solid;border-bottom: #6396d6 1px solid;
}
.pagenum .dot {
float: left;color: #6396d6;
}
.pagenum a {
background: #298ac6; color: #fff; float: left; padding-bottom: 2px; margin: 0px 3px 0px 0px; padding-top: 3px;border-left: #6396d6 1px solid; border-right: #6396d6 1px solid;padding-right: 5px; padding-left: 5px; border-top: #6396d6 1px solid;border-bottom: #6396d6 1px solid;
}
.pagenum a:visited {
color: #fff;
}
.pagenum a:hover {
  background: #f7fbff;color: #6396d6;border-left: #6396d6 1px solid; border-right: #6396d6 1px solid;border-top: #6396d6 1px solid;border-bottom: #6396d6 1px solid;
}


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/445127.htmlTechArticlePHP 分页导航函数 #** ******************************************************* #文件名称:function.php #功能描述:新闻添加修改处理模块 #程序制作:留印(ad...
Statement:
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