public function page_com($model, $order, $where = array(), $pageAll = "15") { $count = $model->where($where)->count(); // 查询满足要求的总记录数 $Page = new \Classs\Page($count, $pageAll); //$Page = new \Think\Page($count,$pageAll);// true实例化分页类 传入总记录数和每页显示的记录数(25) $show = $Page->show(); // 分页显示输出 // 进行分页数据查询 注意limit方法的参数要使用Page类的属性 $list = $model->where($where)->order($order)->limit($Page->firstRow . ',' . $Page->listRows)->select(); $data = array('list' => $list, 'page' => $show); return $data; }
public function index() { $count = $this->model->commCount(); // 查询满足要求的总记录数 $Page = new \Classs\Page($count, '15'); // 实例化分页类 传入总记录数和每页显示的记录数(25) $show = $Page->show(); // 分页显示输出 // 进行分页数据查询 注意limit方法的参数要使用Page类的属性 $list = $this->model->commList($Page->firstRow, $Page->listRows); $this->assign('list', $list); // 赋值数据集 $this->assign('page', $show); // 赋值分页输出 $this->display(); }
public function index() { echo __APP__; exit; $title = empty(I('title')) ? '' : I('title'); //标题 $pid = empty(I('pid')) ? '' : I('pid'); //分类 $start = empty(I('starTime')) ? '' : strtotime(I('starTime')); //开始时间 $end = empty(I('endTime')) ? '' : strtotime(I('endTime')); //结束时间 $where['del'] = array('eq', 0); if ($title) { $where['title'] = array('like', "%{$title}%"); } if ($pid) { $where['cate_id'] = array('eq', $pid); } if ($start) { $where['time'] = array('EGT', $start); } if ($end) { $where['time'] = array('ELT', $end); } if ($start && $end) { $where['time'] = array('BETWEEN', array($start, $end)); } $count = $this->model->articleCount($where); // 查询满足要求的总记录数 $Page = new \Classs\Page($count, 15); // 实例化分页类 传入总记录数和每页显示的记录数(25) $show = $Page->show(); // 分页显示输出 // 进行分页数据查询 注意limit方法的参数要使用Page类的属性 $this->list = $this->model->articleList($Page->firstRow, $Page->listRows, $where); $this->info = $this->cate_list($this->modelCate, '', array('sort', 'id' => 'desc')); $this->assign('page', $show); // 赋值分页输出 $this->display(); }