/** * Override for the load method * * @param string $p_sTemplate The template name * @param array $p_aOptions Optional options */ function load($p_sTemplate, array $p_aOptions = array()) { if (!isset($p_aOptions['aRecentPosts'])) { $oBlog = new APP_Model_Blog(); $p_aOptions['aRecentPosts'] = $oBlog->getPosts('published = 1')->fetchAll(); } parent::load($p_sTemplate, $p_aOptions); }
/** * View an individual blog post * @return void */ function view() { $sPermalink = $this->get(__FUNCTION__, ''); if ($sPermalink == '') { throw new PPI_Exception('Invalid Permalink'); } $oBlog = new APP_Model_Blog(); $post = $oBlog->getPostByPermalink($sPermalink); if (empty($post)) { throw new PPI_Exception('Unable to obtain post information.'); } $this->load('blog/view', compact('post')); }
function blogDelete($p_iBlogID) { $oBlog = new APP_Model_Blog(); $oBlog->delete($p_iBlogID); $this->setFlashMessage('Post successfully deleted'); $this->redirect('admin/blog'); }