public function detailAction() { $this->enableLayout(); // "id" is the named parameters in "Static Routes" $article = Object\BlogArticle::getById($this->getParam("id")); if (!$article instanceof Object\BlogArticle || !$article->isPublished()) { // this will trigger a 404 error response throw new \Zend_Controller_Router_Exception("invalid request"); } $this->view->article = $article; }
public function detailAction() { $this->enableLayout(); $article = Object\BlogArticle::getById($this->getParam("id")); if (!$article instanceof Object\BlogArticle || !$article->isPublished()) { throw new \Zend_Controller_Router_Exception("invalid request"); } $this->view->article = $article; $categories = Object\BlogCategory::getList(); $this->view->categories = $categories; }