Esempio n. 1
0
 public function view_getCategoryList()
 {
     //调用action层, 获取列表数据
     $categoryAct = new CategoryAct();
     $where = 'WHERE is_delete=0 ';
     $total = $categoryAct->act_getCategoryCount($where);
     $num = 100;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     $where .= $page->limit;
     $categoryList = $categoryAct->act_getCategoryList('*', $where);
     //var_dump($categoryList);
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     if ($total > $num) {
         //输出分页显示
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     $navlist = array(array('url' => 'index.php?mod=category&act=getCategoryList', 'title' => '类别管理'), array('url' => 'index.php?mod=category&act=getCategoryList', 'title' => '类别信息列表'));
     $this->smarty->assign('navlist', $navlist);
     $this->smarty->assign('onevar', 4);
     $this->smarty->assign('twovar', 41);
     $this->smarty->assign('show_page', $show_page);
     $this->smarty->assign("categoryList", empty($categoryList) ? null : $categoryList);
     $this->smarty->assign("title", "类别列表");
     $this->smarty->display("categoryList.htm");
 }