smarty模板分页
时间:2006-04-07 来源:freespray
函数部分:
$rs= mysql_query($pagesql);
$recordcount = mysql_num_rows($rs); //È¡µÃ¼Ç¼×ÜÊý
//******¼ÆËã×ÜÒ³Êý*******/
if ( $recordcount % $pagesize == 0 )
$pagecount = $recordcount / $pagesize;
else
$pagecount = intval($recordcount / $pagesize) + 1;
if ( empty($page)||$page
if ( $page>$pagecount )
$page = $pagecount;
$startloc = ($page - 1) * $pagesize;//È·¶¨µ±Ç°Ò³µÄÆðʼ¼Ç¼
//-----------------µ±Ç°Ò³µÄÇ°²¿·ÖÊý×Ö·ÖÒ³----------------------//
if ($page
if ( $page>5 && $pagecount - $page 10 )
$i = $pagecount - 10;
if ($page>5 && $pagecount - $page >=5)
$i = $page - 5;
for (; $i
//--------------µ±Ç°Ò³µÄºó°ë²¿·Ö(°üÀ¨µ±Ç°Ò³)Êý×Ö·ÖÒ³------------//
$j = $pagecount;
if ($page10)
$j = 10;
if ($page>5 && $pagecount - $page >=5)
$j = $page + 5;
for (; $i
return $numpage;//·µ»ØÊý×Ö·ÖÒ³
}
?>
tpl部分
Ö÷Ìâ
ÁôÑÔÈË
ÔĶÁ
1}>
?page=1">首页 ?page=" title="上一页»">上一页
0 }>
?page=">
?page=" title="下一页">下一页 ?page=">末页
总计留言页条
$rs= mysql_query($pagesql);
$recordcount = mysql_num_rows($rs); //È¡µÃ¼Ç¼×ÜÊý
//******¼ÆËã×ÜÒ³Êý*******/
if ( $recordcount % $pagesize == 0 )
$pagecount = $recordcount / $pagesize;
else
$pagecount = intval($recordcount / $pagesize) + 1;
if ( empty($page)||$page
if ( $page>$pagecount )
$page = $pagecount;
$startloc = ($page - 1) * $pagesize;//È·¶¨µ±Ç°Ò³µÄÆðʼ¼Ç¼
//-----------------µ±Ç°Ò³µÄÇ°²¿·ÖÊý×Ö·ÖÒ³----------------------//
if ($page
if ( $page>5 && $pagecount - $page 10 )
$i = $pagecount - 10;
if ($page>5 && $pagecount - $page >=5)
$i = $page - 5;
for (; $i
//--------------µ±Ç°Ò³µÄºó°ë²¿·Ö(°üÀ¨µ±Ç°Ò³)Êý×Ö·ÖÒ³------------//
$j = $pagecount;
if ($page10)
$j = 10;
if ($page>5 && $pagecount - $page >=5)
$j = $page + 5;
for (; $i
return $numpage;//·µ»ØÊý×Ö·ÖÒ³
}
?>
tpl部分
Ö÷Ìâ
ÁôÑÔÈË
ÔĶÁ
1}>
?page=1">首页 ?page=" title="上一页»">上一页
0 }>
?page=">
?page=" title="下一页">下一页 ?page=">末页
总计留言页条
相关阅读 更多 +