public function index() { import('ORG.Util.Page'); $model = new GonggaoModel(); $count = $model->count(); $page = new Page($count, 15); $show = $page->show(); $gonggao_list = $model->order('time desc')->limit($page->firstRow . ',' . $page->listRows)->select(); $this->assign('count', $count); $this->assign('show', $show); $this->assign('gonggao_list', $gonggao_list); $this->display(); }
public function index() { import('ORG.Util.Page'); $article = new GonggaoModel(); $keyword = I('keyword', NULL); $ftype = I('ftype', NULL); $where = array(); if (!empty($keyword) && !empty($ftype)) { $where[$ftype] = array('like', '%' . $keyword . '%'); } $count = $article->where($where)->count(); $page = new Page($count, 8); $show = $page->show(); $this->assign('show', $show); $articlelist = $article->order('id desc')->where($where)->limit($page->firstRow . ',' . $page->listRows)->select(); $this->assign('count', $count); $this->assign('articlelist', $articlelist); $this->display(); }