php 代码public function init() { $where= ; 条件 $page = $_GET[ page ] ? in
php 代码
public function init() {
$where='';//条件
$page = $_GET['page'] ? intval($_GET['page']) : '1';
$infos = $this->listinfo($where,'', $page, 10);//查询数据
$pages = $this->pages;
include $this->admin_tpl('capture');//加载后台模板
}
/**
* 查询多条数据并分页类
* @param $where
* @param $order
* @param $page
* @param $pagesize
* @return unknown_type
*/
final public function listinfo($where = '', $order = '', $page = 1, $pagesize = 10, $key='', $setpages = 5,$urlrule = '',$array = array(), $data = '*') {
$where = to_sqls($where);
$this->number = $this->db->count($where);
$page = max(intval($page), 1);
$offset = $pagesize*($page-1);
$this->pages = pages($this->number, $page, $pagesize, $urlrule, $array, $setpages);
$array = array();
if ($this->number > 0) {
return $this->db->select($where, $data, "$offset, $pagesize", $order, '', $key);
} else {
return array();
}
}
html 代码
<?php {$pages} ?>