예제 #1
0
 /**
  * @param Object_BlogCategory $category
  * @param integer $page
  * @param integer $perpage
  * @return Zend_Paginator
  */
 public function getListByCategory(Object_BlogCategory $category, $page = 1, $perpage = 10)
 {
     $list = $this->_getList();
     $list->setCondition("categories LIKE ?", array("%,{$category->getId()},%"));
     return $this->_paginate($list, $page, $perpage);
 }
예제 #2
0
 /**
  * Entry list by category.
  *
  * @throws Zend_Controller_Action_Exception
  */
 public function categoryAction()
 {
     $this->enableLayout();
     $cat = $this->_getParam('cat');
     $category = Object_BlogCategory::getByPath('/blog/categories/' . $cat);
     if (!$category) {
         throw new Blog_Exception("Category {$cat} doesn't exist");
     }
     try {
         $this->view->paginator = $this->_blog->getListByCategory($category, $this->_getParam('page', 1), $this->_getParam('perpage', 10));
     } catch (Exception $e) {
         throw new Zend_Controller_Action_Exception($e->getMessage(), 404);
     }
     $this->view->category = $category;
     $this->render('default');
 }