利用smarty+adodb分页示例, 下面给出的是分页部份的代码。
分页文件:page.lbi
以下为引用的内容:
当前页 /
[ 首页 ]
[ 首页 ]
[ 上一页 ]
[ 上一页 ]
[ 下一页 ]
[ 下一页 ]
[ 末页 ]
[ 末页 ]
转到 字串6
php部份....
以下为引用的内容:
// level e member's product commend list
public function product_comm($size = 5){
$pre = $size 5 && !empty($_request['lb']) ? and prolb like '%.$_request['lb'].%' : ;
$this->where = judge_flag = 0 and pubname = '.$_request['user'].' $pre ;
$sql = select id, pingpai, img, huohao from user_proinfo where .$this->where.
order by pubtime desc ;
$res = $this->selectrs->selectlimit($sql, $size, ($this->page - 1) * $size );
$this->navipage_cm(`user_proinfo`, $size, $this->where);
return $res;
}
// embed in all must be used cat page function
private function navipage_cm($table, $size, $where){
$count = $this->selectrs->getone(select count(*) from $table where $where );
$pages = @ceil($count/$size);
for ($i = 0; $i $navi_cm = array( option => $arr,
page => $this->page,
pages => $pages,
count => $count, 字串7
size => $size,
param => $this->param
);
$this->tpl->assign(navi_cm, $navi_cm);
}