#1 zhgzzy
请先看一下示例:http://www.shtan.org/main-view-arid-742.html控制器内的代码:$this->arid = $this->spArgs("arid");
$this->p = $this->spArgs("p");
$this->content = $results['content'];
模板页调用代码:=fp($arid,$p,$content) ?>
扩展代码:
spAddViewFunction('fp', array( $this, 'fp'));
function fp($arid,$p,$contents)
{
$arr = explode('',$contents); //数组长度&总页数
$total = count($arr); //当前页
$nowpage = $p?$p:1; //上页
$pdiv = '
- ';
- 总{$nowpage}/{$total}页 ";
- {$i} ";
$pdiv .= "
for($i = 1; $i<=$total; $i++)
{
$url = spUrl(main,view,array('arid'=>$arid,'p'=>$i));
$pdiv .= "
}
$pdiv .= '
'; //输出内容
echo $arr[$nowpage-1]; //不分页则不显示分页列表
if( $total <=1) $pdiv = ''; //输出分页列表
echo $pdiv;
}
2010-09-17 13:24:09