Example #1
0
 function show_cate()
 {
     $p = isset($_GET["p"]) ? $_GET["p"] : "1";
     //当前是第几页
     $page_size = C("page_size");
     //每页多少条数据
     $count = $this->model->count_art();
     //总共多少条数据
     $page_count = round($count / $page_size);
     //页面总数
     require LIB_PATH . "/page.php";
     $cateId = isset($_GET["cateId"]) ? "&cateId=" . $_GET["cateId"] : "";
     $page = new Page($p, $page_size, $page_count, "index.php?c=article&a=show_cate" . $cateId);
     $this->assign("page_show", $page->page_show());
     $limit = ($p - 1) * $page_size;
     //limit起始数字
     $cateId = $_GET['cateId'];
     $contents = $this->model->showCate($cateId, $limit, $page_size);
     //dump($contents);exit;
     $this->assign('contents', $contents);
     $this->assign('cateId', $cateId);
     $this->display();
 }
Example #2
0
 function product()
 {
     $id = $_GET['id'];
     $child = $this->model->cate_id($id);
     $arts = $this->model->arts($child);
     //dump($arts);exit;
     $count1 = count($arts);
     // echo $count;exit;
     foreach ($arts as $k => &$art) {
         $art['pic_path'] = substr($art['pic_path'], 14);
         $art['pic_path'] = '/upload/_thumbs/Images/' . $art['pic_path'];
     }
     //dump($arts);exit;
     $p = isset($_GET["p"]) ? $_GET["p"] : "1";
     //当前是第几页
     $page_size = 8;
     //每页多少条数据
     $count = $count1;
     //总共多少条数据
     $page_count = ceil($count / $page_size);
     //页面总数
     require LIB_PATH . "/page.php";
     $page = new Page($p, $page_size, $page_count, "index.php?c=index&a=product&id=18");
     $this->assign("page_show", $page->page_show());
     $limit = ($p - 1) * $page_size;
     //limit起始数字
     $arts = $this->model->arts1($child, $limit, $page_size);
     $this->assign('arts', $arts);
     $this->display();
 }