#1 zhgzzy
模板输出文件中的内容:=fp(spUrl(main,view,array(arid=>$id,pages=>$pages)),$contents) ?>
function.php 扩展函数文章分页:
spAddViewFunction('fp', array( $this, 'fp'));
function fp($url,$contents )
{
$arr = explode('',$contents); //数组长度
$total = count($arr); //总页数
$nowpage = $_GET['pages']?$_GET['pages']:1; //当前页
$pdiv = '
- ';
- {$i} ";
$pdiv .= "总{$nowpage}/{$total}页 ";
for($i = 1; $i<=$total; $i++)
{
$pdiv .= "
}
$pdiv .= '
$pdiv .= $arr[$nowpage-1]; //输出分页列表
if( $total <=1) $pdiv = ''; //不分页则不显示分页列表
return $pdiv;
}
2010-09-16 18:06:46