public function handleErrorAddComment() { if ($this->getRequest()->isXmlHttpRequest()) { $this->post = sfSimpleBlogPostPeer::retrieveByStrippedTitleAndDate($this->getRequestParameter('stripped_title'), $this->getRequestParameter('date')); $this->forward404Unless($this->post); $this->comments = $this->post->getComments(); $this->getResponse()->setContentType('text/html; charset=utf-8'); return 'Ajax'; } else { $this->forward('sfSimpleBlog', 'show'); } }
public function executeCommentsForPostFeed() { sfLoader::loadHelpers(array('I18N')); $post = sfSimpleBlogPostPeer::retrieveByStrippedTitleAndDate($this->getRequestParameter('stripped_title'), $this->getDateFromRequest()); $this->forward404Unless($post); $comments = sfSimpleBlogCommentPeer::getForPost($post, $this->getRequestParameter('nb', sfConfig::get('app_sfSimpleBlog_feed_count', 5))); $this->feed = sfFeedPeer::createFromObjects($comments, array('format' => $this->getRequestParameter('format', 'atom1'), 'title' => __('Comments on post "%1%" from %2%', array('%1%' => $post->getTitle(), '%2%' => sfConfig::get('app_sfSimpleBlog_title', ''))), 'link' => $this->getController()->genUrl('sfSimpleBlog/show?stripped_title=' . $post->getStrippedTitle()), 'authorName' => sfConfig::get('app_sfSimpleBlog_author', ''), 'methods' => array('title' => 'getPostTitle', 'authorEmail' => ''))); $this->setTemplate('feed'); }