PHP classic paging navigation function source code: Copy PHP content to the clipboard
PHP code:
#************************************************ **********
#File name: function.php
#Function description: News addition and modification processing module
#Program Production: Leave a Print (adleyliu)
#Contactqq: 14339095
#Contact email: [[email protected]][email protected][/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 records
#Total number of pages
#Current page number
#Number of displays per page
//$pageurl='?';
$pcount = $pages;
$page_info = '<div class=pagenum>';
$page_info .= '<div class=num>';
if (($pcount > 1) && ($pcount == $pagecount) ){
$page_info .= '<a href = '.$pageurl.'page='.intval($pagecount-1).'>Previous page</a>';
}elseif (($pagecount != 1) && ($pcount != $pagecount)){
$page_info .= '<a href = '.$pageurl.'page='.intval($pagecount-1).'>Previous page</a>';
}
$page_info .= '<a href = '.$pageurl.'page=1>Top of page</a>';
if ($pagecount > 4){
$page_info .= '<a href = '.$pageurl.'page=1>[1]</a><span class=dot>...</span>';
}
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 .= '<span class=normal>'.$n.'</span>';
}else{
$page_info .= '<a href = '.$pageurl.'page='.$n.'>['.$n.']</a>';
}
}
}
if ($pagecount+2 < $pcount){
$page_info .= '<span class=dot>...</span><a href='.$pageurl.'page='.$pcount.'>['.$pcount.']</a>' ;
}
$page_info .= '<a href = '.$pageurl.'page='.$pcount.'>Page footer</a>';
if (($pagecount == 1) && ($pcount != $pagecount) && ($pcount != 0)){
$page_info .= '<a href = '.$pageurl.'page='.intval($pagecount + 1).'>Next page</a>';
}else if (($pagecount != 1) && ($pcount != $pagecount)){
$page_info .= '<a href = '.$pageurl.'page='.intval($pagecount + 1).'>Next page</a>';
}
$page_info .= '</div></div>';
$page_info .= '<div class=pagenum>';
$page_info .= '<div class=num><span class=normal> Total: '.$rsnum .' items / '.$pcount.' pages per page / '.$pagesize.' items </span></ div>';
$page_info .= ' <div class=num>';
//echo '<form name=page action='.$pageurl.'>';
$page_info .= 'Go to';
$page_info .= '<input type=text name=page value='1' class=login_left style='width:28px;height:18px;'>';
$page_info .= 'Page<input type=submit name=submit3 class=login_submit style='width:28px;height:18px;padding-top:1px;' onclick=document.myform.action.value='go '> ';
//echo '</form>';
$page_info .= '</div>';
$page_info .= '</div>';
return $page_info;
}