/** * View post * * @throws Zend_Controller_Action_Exception */ public function indexAction() { if (!($postId = $this->_getParam('id'))) { $this->_forwardNotFound(); return; } $posts = new Forum_Model_Post_Table(); if (!($post = $posts->getById($postId))) { $this->_forwardNotFound(); return; } $users = new Users_Model_User_Table(); $this->view->author = $users->getById($post->userId); $categories = new Categories_Model_Category_Table(); $this->view->category = $categories->getById($post->categoryId); /** update count view */ $post->incViews(); $this->view->post = $post; }
/** * View post * * @throws Zend_Controller_Action_Exception */ public function indexAction() { if (!($alias = $this->_getParam('alias'))) { $this->_forwardNotFound(); return; } $posts = new Blog_Model_Post_Table(); if (!($row = $posts->getByAlias($alias))) { $this->_forwardNotFound(); return; } $users = new Users_Model_User_Table(); $this->view->user = $users->getById($row->userId); $categories = new Categories_Model_Category_Table(); $this->view->category = $categories->getById($row->categoryId); /** update count view */ $row->incViews(); $this->view->row = $row; $this->view->page = $this->_getParam('page'); }