/** * 图片列表 * @return [type] [description] */ public function index($key = "") { $sid = session('adminId'); //判断用户是否登陆 if (!isset($sid)) { redirect(U('Login/index')); } else { if ($key == "") { $model = D('ImagesView'); } else { $where['images.name'] = array('like', "%{$key}%"); $where['modulecategory.name'] = array('like', "%{$key}%"); $where['_logic'] = 'or'; $model = D('ImagesView')->where($where); } $count = $model->where($where)->count(); // 查询满足要求的总记录数 $Page = new \Extend\Page($count, 15); // 实例化分页类 传入总记录数和每页显示的记录数(25) $show = $Page->show(); // 分页显示输出 $post = $model->limit($Page->firstRow . ',' . $Page->listRows)->where($where)->order('Images.id DESC')->select(); $this->assign('model', $post); $this->assign('page', $show); $this->display(); } }
/** * 漏洞报告列表 * @return [type] [description] */ public function index($key = "") { if ($key == "") { $model = D('PostView'); } else { $where['post.title'] = array('like', "%{$key}%"); $where['member.username'] = array('like', "%{$key}%"); $where['category.title'] = array('like', "%{$key}%"); $where['_logic'] = 'or'; $model = D('PostView')->where($where); } $id = session('userId'); $count = $model->where($where)->where('user_id=' . $id)->count(); // 查询满足要求的总记录数 $Page = new \Extend\Page($count, 15); // 实例化分页类 传入总记录数和每页显示的记录数(15) $show = $Page->show(); // 分页显示输出 $post = $model->limit($Page->firstRow . ',' . $Page->listRows)->where($where)->order('post.id DESC')->where('user_id=' . $id)->select(); $tmodel = M('setting'); $title = $tmodel->where('id=1')->select(); $this->assign('title', $title); $this->assign('model', $post); $this->assign('page', $show); $this->display(); }
public function index() { $model = D('ProgramPublicService'); $count = $model->where('cate_id=4')->count(); // 查询满足要求的总记录数 $Page = new \Extend\Page($count, 15); // 实例化分页类 传入总记录数和每页显示的记录数(25) $show = $Page->show(); // 分页显示输出 $post = $model->limit($Page->firstRow . ',' . $Page->listRows)->where('cate_id=4')->order('project.id DESC')->select(); $this->assign('model', $post); $this->assign('page', $show); $images = M('images')->where('location=9 AND status=1')->select(); $this->assign('image', $images); $this->display(); }
public function index() { $model = D('SpecialRecommendation'); $count = $model->where($where)->count(); // 查询满足要求的总记录数 $Page = new \Extend\Page($count, 15); // 实例化分页类 传入总记录数和每页显示的记录数(25) $show = $Page->show(); // 分页显示输出 $post = $model->limit($Page->firstRow . ',' . $Page->listRows)->where($where)->order('specialrecommendation.id DESC')->select(); $this->assign('model', $post); $this->assign('page', $show); $images = M('images')->where('location=4 AND status=1')->select(); $this->assign('image', $images); $this->display(); }
/** * 分类列表 * @return [type] [description] */ public function index($key = "") { if ($key === "") { $model = M('setting'); } else { $where['key'] = array('like', "%{$key}%"); $where['description'] = array('like', "%{$key}%"); $where['_logic'] = 'or'; $model = M('setting')->where($where); } $count = $model->where($where)->count(); // 查询满足要求的总记录数 $Page = new \Extend\Page($count, 15); // 实例化分页类 传入总记录数和每页显示的记录数(25) $show = $Page->show(); // 分页显示输出 $setting = $model->limit($Page->firstRow . ',' . $Page->listRows)->where($where)->order('id DESC')->select(); $this->assign('model', $setting); $this->assign('page', $show); $this->display(); }
/** * 文章列表 * @return [type] [description] */ public function index($key = "") { if ($key === "") { $model = D('NewsView'); //默认情况下显示全部 } else { //搜索功能的时候搜索特定的文章 $where['news.title'] = array('like', "%{$key}%"); $where['member.username'] = array('like', "%{$key}%"); $where['category.title'] = array('like', "%{$key}%"); $where['_logic'] = 'or'; $model = D('NewsView')->where($where); } $count = $model->where($where)->count(); // 查询满足要求的总记录数 $Page = new \Extend\Page($count, 15); // 实例化分页类 传入总记录数和每页显示的记录数(25) $show = $Page->show(); // 分页显示输出 $post = $model->limit($Page->firstRow . ',' . $Page->listRows)->where($where)->order('id DESC')->select(); $this->assign('news', $post); $this->assign('page', $show); $this->display(); }