コード例 #1
0
 public function viewAction()
 {
     $categories = new Categories();
     $feeds = new Feeds();
     $this->view->category = $categories->getBySlug($this->getRequest()->getParam('id'));
     $this->view->category->feeds = $feeds->getByCategory($this->view->category->id);
     $posts = new Posts();
     $limit = 10;
     $page = $this->getRequest()->getParam('page') ? $this->getRequest()->getParam('page') : 1;
     $this->view->posts = $posts->getByCategory($this->view->category->id, $page, $limit);
     $total = $posts->getByCategory($this->view->category->id, 1, 0, true)->total;
     $this->view->paginator = Zend_Paginator::factory($total);
     $this->view->paginator->setCurrentPageNumber($page);
     $this->view->paginator->setItemCountPerPage($limit);
 }
コード例 #2
0
ファイル: CategoryController.php プロジェクト: aprondak/ifphp
 public function viewAction()
 {
     $categories = new Categories();
     $feeds = new Feeds();
     $this->view->category = $categories->getBySlug($this->getRequest()->getParam('id'));
     $this->view->category->feeds = $feeds->getByCategory($this->view->category->id);
     $posts = new Posts();
     $limit = 5;
     $page = $this->getRequest()->getParam('page') ? $this->getRequest()->getParam('page') : 1;
     $this->view->posts = $posts->getByCategory($this->view->category->id, $page, $limit);
     $total = $posts->getByCategory($this->view->category->id, 1, 0, true)->total;
     $this->view->paginator = Zend_Paginator::factory($total);
     $this->view->paginator->setCurrentPageNumber($page);
     $this->view->paginator->setItemCountPerPage($limit);
     $this->view->keywords = implode('', array('ifphp', 'news aggragator', 'support,' . $this->view->categpry->title));
     //TODO add paging
 }