public function index() { $IndexModel = new IndexModel(); $slider = $IndexModel->getSlider(); $this->assign('slider', $slider); $NewsModel = new NewsListModel(); $newItem = $NewsModel->getIndexNews(); $this->assign('newItems', $newItem); $cateModel = new CategoryModel(); $category = $cateModel->getCategory(); $this->assign('cate', $category); $this->show(); }
public function index($page = 1, $page_size = 10) { $newsModel = new NewsListModel(); $newItem = $newsModel->getNews($page, $page_size); /*dump($newItem);*/ $total_count = $newsModel->getTotal(); $pageMeta = array('page' => $page, 'page_size' => $page_size, 'page_count' => ceil($total_count / $page_size), 'total_count' => $total_count); $this->assign('item', $newItem); $this->assign('page', $pageMeta); $cateModel = new CategoryModel(); $category = $cateModel->getCategory(); $this->assign('cate', $category); $this->display('newsList'); /*$this->redirect('index/index');*/ }