public function executeFeed(sfWebRequest $request) { $vanity = $request->getParameter('id'); $s = $request->getParameter('s', 0); $culture = $this->getUser()->getCulture(); $c = new Criteria(); $c->add(PropuestaPeer::VANITY, $vanity); $entity = PropuestaPeer::doSelectOne($c); $this->forward404Unless($entity); if ($entity->getCulture() != $culture) { $this->redirect("@homepage"); } $filter = array(); $filter['type_id'] = Propuesta::NUM_ENTITY; $filter['entity_id'] = $entity->getId(); $reviews = SfReviewManager::getReviews($filter); $title = sfContext::getInstance()->getI18N()->__('%1% en Voota.es', array('%1%' => $entity)); $description = sfContext::getInstance()->getI18N()->__('Opiniones sobre %1%, %2% votos a favor y %3% votos en contra', array('%1%' => $entity, '%2%' => $entity->getSumu(), '%3%' => $entity->getSumd())); $feed = new sfRssFeed(); $feed->setTitle($title); $feed->setLanguage($culture); $feed->setSubtitle($description); $feed->setDescription($description); $feed->setLink('propuesta/show?id=' . $entity->getVanity()); $domainExt = $culture == 'ca' ? "cat" : $culture; $feed->setAuthorName("Voota.{$domainExt}"); $feedImage = new sfFeedImage(); $feedImage->setLink('propuesta/show?id=' . $entity->getVanity()); $feedImage->setImage(S3Voota::getImagesUrl() . '/' . $entity->getImagePath() . '/cc_' . $entity->getImagen()); $feedImage->setTitle($entity); $feed->setImage($feedImage); foreach ($reviews as $review) { $item = new sfFeedItem(); $item->setTitle(sfContext::getInstance()->getI18N()->__('%1%, voota %2%.', array('%1%' => $review->getSfGuardUser(), '%2%' => $review->getValue() == -1 ? sfContext::getInstance()->getI18N()->__('en contra') : sfContext::getInstance()->getI18N()->__('a favor')))); $item->setLink('sfReviewFront/show?id=' . SfVoUtil::reviewPermalink($review)); $item->setAuthorName($review->getSfGuardUser()); $item->setPubdate($review->getCreatedAt('U')); $item->setUniqueId($review->getId()); $avatar = S3Voota::getImagesUrl() . '/usuarios/cc_s_' . $review->getSfGuardUser()->getProfile()->getImagen(); $text = $culture == $review->getCulture() || !$review->getCulture() ? $review->getText() : ''; $img = $review->getSfGuardUser()->getProfile()->getImagen() ? "<img src=\"{$avatar}\" alt =\"" . $review->getSfGuardUser() . "\" /> " : ""; $content = "{$text}"; $item->setDescription($content); $feed->addItem($item); } $this->feed = $feed; }
public function executeFeed($request) { // Firstly, fetch the articles we will put in the feed $articles = Doctrine_Query::create()->from('Article a')->withI18n()->where('aTranslation.is_active = ?', true)->orderBy('aTranslation.created_at DESC')->limit(20)->execute(); // Then create a sfRssFeed instance and configure it $this->feed = new sfRssFeed(); $this->feed->setTitle('Últimos artículos'); $this->feed->setAuthorName('Casa Taller Pedro Pablo Oliva'); // here we use £link to get blog page absolute url. // this is the prefered way to get a page url. $blogUrl = $this->getHelper()->link('article/list')->getAbsoluteHref(); $this->feed->setLink($blogUrl); // Add each article to the feed foreach ($articles as $article) { $item = new sfFeedItem(); $item->setTitle($article->title); // use link helper to get the article page url $item->setLink($this->getHelper()->link($article)->getAbsoluteHref()); $item->setAuthorName($article->Author); $item->setUniqueId($article->title . ' (' . $article->id . ')'); $dateObject = new DateTime($article->createdAt); $item->setPubdate($dateObject->format('U')); $item->setDescription($this->getHelper()->media($article->Image)->size(300, 200) . $this->getService('markdown')->toHtml($article->body)); $this->feed->addItem($item); } // disable the layout $this->setLayout(false); }
public function executeSearch() { $feed = new sfAtom1Feed(); $feed->setTitle('Hoydaa Snippets'); $feed->setLink('http://codesnippet.hoydaa.org'); $feed->setAuthorEmail('*****@*****.**'); $feed->setAuthorName('Hoydaa Snippets'); $querystring = $this->getRequestParameter('q'); $query = new sfLuceneCriteria($this->getLuceneInstance()); $query->addDescendingSortBy('createdat'); $query->addSane($querystring); $pager = new sfLucenePager($this->getLuceneInstance()->friendlyFind($query)); $num = $pager->getNbResults(); if ($num > 0) { $pager->setMaxPerPage(10); $pager->setPage(1); foreach ($pager->getResults() as $result) { $item = new sfFeedItem(); $item->setTitle($result->getTitle()); $item->setLink('snippet/show?id=' . $result->getId()); $item->setAuthorName($result->getContributor()); $item->setPubDate(strtotime($result->getCreatedAt())); //$item->setAuthorEmail(($code->getSfGuardUser() ? // $code->getSfGuardUser()->getProfile()->getEmail() : $code->getEmail())); $item->setUniqueId($result->getId()); $item->setDescription($result->getSummary()); $feed->addItem($item); } } $this->feed = $feed; $this->setTemplate('feed'); }
/** * Создать ленту * * @param array $rows * @param array $parameters * * @return sfFeed */ private function buildFeed(array $rows, array $parameters) { // default parameters $parameters = array_merge(sfConfig::get('app_feeds_default_parameters', array()), $parameters); $feed = sfFeed::newInstance($parameters['feed_type']); $feed->setTitle($parameters['title']); $feed->setLink($parameters['link']); $feed->setAuthorName($parameters['author_name']); if (isset($parameters['author_email'])) { $feed->setAuthorEmail($parameters['author_email']); } foreach ($rows as $row) { $item = new sfFeedItem(); $item->setTitle($row['title']); $item->setAuthorName($row['author_name']); if (isset($parameters['permalink_url'])) { $item->setLink(sprintf('@%s?%s=%s', $parameters['permalink_url'], $parameters['permalink_param_name'], $row[$parameters['permalink_param_column']])); } if (isset($row['author_email'])) { $item->setAuthorEmail($row['author_email']); } $item->setPubdate(strtotime($row['created_at']) - date('Z', strtotime($row['created_at']))); $item->setUniqueId($row['id']); $item->setDescription($row['description']); $feed->addItem($item); } $this->feed = $feed; $this->getContext()->getResponse()->setContentType($feed->getContentType()); $this->setTemplate('feed'); }
public function addItemFromArray($item_array) { $item = new sfFeedItem(); $item->setTitle(isset($item_array['title']) ? $item_array['title'] : ''); $item->setLink(isset($item_array['link']) ? $item_array['link'] : ''); $item->setDescription(isset($item_array['description']) ? $item_array['description'] : ''); $item->setAuthorEmail(isset($item_array['authorEmail']) ? $item_array['authorEmail'] : ''); $item->setAuthorName(isset($item_array['authorName']) ? $item_array['authorName'] : ''); $item->setAuthorLink(isset($item_array['authorLink']) ? $item_array['authorLink'] : ''); $item->setPubdate(isset($item_array['pubdate']) ? $item_array['pubdate'] : ''); $item->setComments(isset($item_array['comments']) ? $item_array['comments'] : ''); $item->setUniqueId(isset($item_array['uniqueId']) ? $item_array['uniqueId'] : ''); $item->setEnclosure(isset($item_array['enclosure']) ? $item_array['enclosure'] : ''); $item->setCategories(isset($item_array['categories']) ? $item_array['categories'] : ''); $this->items[] = $item; }
public function executeRecent(sfWebRequest $request) { $feed = $this->getFeed($request->getParameter('format')); $c = new Criteria(); $c->addDescendingOrderByColumn(PluginPeer::CREATED_AT); $c->setLimit(20); $plugins = PluginPeer::doSelect($c); foreach ((array) $plugins as $plugin) { $item = new sfFeedItem(); $item->setTitle($plugin->getTitle()); $item->setLink('@plugin?slug=' . $plugin->getSlug()); $item->setAuthorName($plugin->getAuthor()->getFullName()); $item->setPubdate($plugin->getCreatedAt('U')); $item->setUniqueId($plugin->getSlug()); $item->setContent($plugin->getDescription()); $feed->addItem($item); } $this->feed = $feed; }
public function executeRss(dmWebRequest $request) { $records = dmDb::query('Plugin p')->leftJoin('p.CreatedBy user')->where('p.is_active = ?', true)->orderBy('p.position ASC')->limit(20)->fetchRecords(); $this->preloadPages($records); $feed = new sfRssFeed(); $feed->setTitle('Diem Project Plugins'); $feed->setLink('http://diem-project.org/plugins'); $feed->setAuthorName('Thibault Duplessis'); foreach ($records as $record) { $item = new sfFeedItem(); $item->setTitle($record->name); $item->setLink($this->getHelper()->link($record)->getAbsoluteHref()); $item->setAuthorName($record->CreatedBy); $item->setPubdate($record->getDateTimeObject('created_at')->format('U')); $item->setUniqueId($record->name . ' (' . $record->id . ')'); $item->setDescription($this->getService('markdown')->toHtml($record->text)); $feed->addItem($item); } $this->feed = $feed; }
protected function createFeed($posts, $tag) { $feed = new sfAtom1Feed(); $feed->setTitle('Planeta PHP.pl' . (empty($tag) ? '' : ' - tag: ' . $tag)); $feed->setLink('@homepage'); $feed->setFeedUrl(empty($tag) ? '@feed' : '@feeds?tag=' . $tag); $feed->setAuthorEmail('*****@*****.**'); $feed->setAuthorName('Planeta PHP.pl'); foreach ($posts as $post) { $item = new sfFeedItem(); $item->setTitle($post->getTitle()); $item->setLink($post->getLink()); $item->setAuthorName($post->getBlog()->getAuthor()); $item->setPubdate($post->getCreatedAt('U')); $item->setUniqueId($post->getLink()); $item->setContent($post->getContent()); $item->setCategories($post->getTagNames()); $feed->addItem($item); } return $feed; }
/** * Executes index action * */ public function executeShow() { $feed = new sfAtom1Feed(); $feed->setTitle('Flinders University Events'); $feed->setLink('http://www.flinders.edu.au/'); $feed->setAuthorEmail('*****@*****.**'); $feed->setAuthorName('Web Development'); $feedImage = new sfFeedImage(); $feedImage->setFavicon('http://www.flinders.edu.au/favicon.ico'); $feed->setImage($feedImage); $conn = Propel::getConnection(); $query = ' SELECT * FROM %s JOIN %s ON (%s = %s) WHERE %s = true AND %s::date >= now()::date ORDER BY %s ASC '; $query = sprintf($query, EtimePeer::TABLE_NAME, EventPeer::TABLE_NAME, EtimePeer::EVENT_ID, EventPeer::ID, EventPeer::PUBLISHED, EtimePeer::START_DATE, EtimePeer::START_DATE); $stmt = $conn->prepareStatement($query); $resultset = $stmt->executeQuery(ResultSet::FETCHMODE_NUM); $etimes = EtimePeer::populateObjects($resultset); foreach ($etimes as $etime) { $item = new sfFeedItem(); $item->setTitle($etime->getEvent()->getTitle() . ' - ' . $etime->getTitle()); $item->setLink('@show_outside_event?slug=' . $etime->getEvent()->getSlug()); $item->setAuthorName($etime->getEtimePeoples()); $item->setPubdate($etime->getStartDate('U')); $item->setUniqueId($etime->getId()); if ($etime->getDescription()) { $item->setDescription($etime->getDescription()); } else { $item->setDescription($etime->getEvent()->getDescription()); } $feed->addItem($item); } $this->feed = $feed; }
/** * Executes index action * * @param sfRequest $request A request object */ public function executeIndex(sfWebRequest $request) { $this->getContext()->getConfiguration()->loadHelpers(array('Url')); $feed = new sfAtom1Feed(); $feed->setTitle('日本Symfonyユーザー会 コンテンツ更新情報'); $feed->setLink($this->getController()->genUrl('@homepage')); $feed->setAuthorEmail('*****@*****.**'); $feed->setAuthorName('日本Symfonyユーザー会'); $feedImage = new sfFeedImage(); $feedImage->setFavicon(public_path('images/favicon.ico')); $pages = Doctrine_Query::create()->from('Page p')->limit(10)->orderBy('p.last_updated desc')->execute(); foreach ($pages as $page) { $item = new sfFeedItem(); $item->setTitle($page->getTitle()); $item->setLink(url_for_page($page->getPath())); $item->setPubdate($page->getDateTimeObject('last_updated')->format('U')); $item->setDescription(strip_tags($page->getContentRendered())); $item->setContent($page->getContentRendered()); $feed->addItem($item); } $this->feed = $feed; }
public function executeNoticiesCulturalsLastPosts() { $this->IDS = 1; $feed = new sfAtom1Feed(); $feed->setTitle('NotÃcies Culturals de Girona'); $feed->setLink('http://www.casadecultura.org/noticiesculturals'); $feed->setAuthorEmail('*****@*****.**'); $feed->setAuthorName('Giroscopi || Casa de Cultura de Girona'); $feedImage = new sfFeedImage(); $feedImage->setFavicon('http://www.casadecultura.cat/images/blogs/Dissenys/noticies_culturals/blog_02.png'); $feed->setImage($feedImage); $C = new Criteria(); $C = AppBlogsEntriesPeer::getCriteriaActiu($C, $this->IDS); $C->add(AppBlogsEntriesPeer::PAGE_ID, 1); $C->addDescendingOrderByColumn(AppBlogsEntriesPeer::ID); $Q = AppBlogsEntriesPeer::doSelect($C); $WEBROOTURL = OptionsPeer::getString('SF_WEBROOTURL', $this->IDS); foreach ($Q as $post) { $item = new sfFeedItem(); $item->setTitle($post->getTitle()); $item->setLink($WEBROOTURL . 'noticiesculturals?NOTICIA_ID=' . $post->getId()); $item->setAuthorName('Giroscopi'); $item->setAuthorEmail('*****@*****.**'); $IMG = $post->getImages(); if (!$IMG) { $url = ""; } else { $url = '<img width="100px" src="' . $WEBROOTURL . 'images/blogs/' . $IMG[0]->getUrl() . '">'; } $url_web = $WEBROOTURL . 'noticiesculturals?NOTICIA_ID=' . $post->getId(); $item->setUniqueId($url_web); $TEXT = "\t\r\n\t \t\t <table border=\"0\"><tr><td>{$url}</td><td>\t \t\t \r\n\t\t <h1>{$post->getTitle()}</h1><br />\r\n\t\t <h2>{$post->getSubtitle1()}</h2><br />\r\n\t\t <h3>{$post->getSubtitle2()}</h3><br />\r\n\t\t <a href=\"{$post->getUrl()}\">Web</a><br />\r\n\t\t <a href=\"{$url_web}\">NotÃcia original</a>\r\n\t\t </td></tr></table>\t \r\n\t "; $item->setContent($TEXT); $feed->addItem($item); } $this->feed = $feed; $this->setLayout('blank'); $this->setTemplate('RSS'); }
public function executeFeed(sfWebRequest $request) { $vanity = $request->getParameter('username'); $this->f = $request->getParameter('f'); $culture = $this->getUser()->getCulture(); $c = new Criteria(); $c->add(SfGuardUserProfilePeer::VANITY, $vanity, Criteria::EQUAL); $userProfile = SfGuardUserProfilePeer::doSelectOne($c); $this->forward404Unless($userProfile); $this->user = $userProfile->getsfGuardUser(); if (!$this->user->getIsActive() && is_numeric($userProfile->getFacebookUid())) { $user = SfGuardUserPeer::retrieveByPK($userProfile->getFacebookUid()); $this->forward404Unless($user); $this->redirect('perfil/show?username='******'%1% en Voota.es', array('%1%' => $this->user)); $descripcion = SfVoUtil::cutToLength($userProfile->getPresentacion(), 155, '...', true); $description = $descripcion ? $descripcion : sfContext::getInstance()->getI18N()->__('Votos y opiniones de %1% sobre políticos y partidos de España', array('%1%' => trim($this->user) ? $this->user : $this->user->getProfile()->getVanity())); $feed = new sfRssFeed(); $feed->setTitle($title); $feed->setLanguage($culture); $feed->setSubtitle($description); $feed->setDescription($description); $feed->setLink('perfil/show?username='******'ca' ? "cat" : $culture; $feed->setAuthorName("Voota.{$domainExt}"); $feedImage = new sfFeedImage(); $feedImage->setLink('perfil/show?username='******'/usuarios/cc_' . $this->user->getProfile()->getImagen()); $feedImage->setTitle($this->user); $feed->setImage($feedImage); foreach ($reviews as $review) { $item = new sfFeedItem(); $entityText = ""; if (!$review->getSfReviewType()) { $tmpReview = $review->getSfReviewRelatedBySfReviewId(); $entityText = sfContext::getInstance()->getI18N()->__('Otra opinión sobre') . ' '; } else { $tmpReview = $review; } $sfReviewType = SfReviewTypePeer::retrieveByPk($tmpReview->getSfReviewTypeId()); $peer = $sfReviewType->getModel() . 'Peer'; $entity = $peer::retrieveByPk($tmpReview->getEntityId()); $entityText .= $entity; $item->setTitle(sfContext::getInstance()->getI18N()->__('%1%, voota %2%.', array('%1%' => $entityText, '%2%' => $review->getValue() == -1 ? sfContext::getInstance()->getI18N()->__('en contra') : sfContext::getInstance()->getI18N()->__('a favor')))); $item->setLink('sfReviewFront/show?id=' . SfVoUtil::reviewPermalink($review)); $item->setAuthorName($review->getSfGuardUser()); $item->setPubdate($review->getCreatedAt('U')); $item->setUniqueId($review->getId()); $avatar = S3Voota::getImagesUrl() . '/usuarios/cc_s_' . $review->getSfGuardUser()->getProfile()->getImagen(); $text = $culture == $review->getCulture() || !$review->getCulture() ? $review->getText() : ''; $img = $review->getSfGuardUser()->getProfile()->getImagen() ? "<img src=\"{$avatar}\" alt =\"" . $review->getSfGuardUser() . "\" /> " : ""; $content = "{$text}"; $item->setDescription($content); $feed->addItem($item); } $this->feed = $feed; }
private function setPosts(&$feed, $posts) { foreach ($posts as $post) { $item = new sfFeedItem(); $item->setTitle(__('Пост №') . $post->getId()); $item->setLink('post/show?id=' . $post->getId()); $item->setAuthorName($post->getUser()->getUsername()); $item->setPubdate(strtotime($post->getCreatedAt())); $item->setUniqueId($post->getId()); $item->setDescription($this->getPartial('post/post_rss', array('post' => $post))); $feed->addItem($item); } }
public function executeFeed(sfWebRequest $request) { $this->page = $request->getParameter("page", "1"); $this->entityId = $request->getParameter("entityId", false); $this->value = $request->getParameter("value", false); $this->sfReviewType = $request->getParameter("type_id", false); $this->text = $request->getParameter("t", false); $this->entity = false; $this->filter = false; $culture = $this->getUser()->getCulture(); $filter = array(); //$filter['culture'] = $culture; if ($this->sfReviewType) { $filter['type_id'] = $this->sfReviewType; } if ($this->text) { $filter['textFilter'] = 'text'; } $reviewsPager = SfReviewManager::getReviews($filter); $str = ''; switch ($this->sfReviewType) { case 1: $str = sfContext::getInstance()->getI18N()->__("políticos"); break; case 2: $str = sfContext::getInstance()->getI18N()->__("partidos"); break; case 3: $str = sfContext::getInstance()->getI18N()->__("propuestas"); break; case "null": $str = sfContext::getInstance()->getI18N()->__("respuestas a otros comentarios"); break; } $title = sfContext::getInstance()->getI18N()->__("Últimas opiniones%1% en Voota.", array('%1%' => $str ? " " . sfContext::getInstance()->getI18N()->__("sobre") . " {$str}" : "")); $reviews = $reviewsPager->getResults(); $description = ($reviews[0]->getAnonymous() ? sfContext::getInstance()->getI18N()->__('anónimo') : (trim($reviews[0]->getSfGuardUser()) ? $reviews[0]->getSfGuardUser() : $reviews[0]->getSfGuardUser()->getProfile())) . " (" . ago(strtotime($reviews[0]->getModifiedAt() ? $reviews[0]->getModifiedAt() : $reviews[0]->getCreatedAt())) . "), " . ($reviews[1]->getAnonymous() ? sfContext::getInstance()->getI18N()->__('anónimo') : (trim($reviews[1]->getSfGuardUser()) ? $reviews[1]->getSfGuardUser() : $reviews[1]->getSfGuardUser()->getProfile())) . " (" . ago(strtotime($reviews[1]->getModifiedAt() ? $reviews[1]->getModifiedAt() : $reviews[1]->getCreatedAt())) . "), " . ($reviews[2]->getAnonymous() ? sfContext::getInstance()->getI18N()->__('anónimo') : (trim($reviews[2]->getSfGuardUser()) ? $reviews[2]->getSfGuardUser() : $reviews[2]->getSfGuardUser()->getProfile())) . " (" . ago(strtotime($reviews[2]->getModifiedAt() ? $reviews[2]->getModifiedAt() : $reviews[2]->getCreatedAt())) . "), " . "..."; $feed = new sfRssFeed(); $feed->setTitle($title); $feed->setLanguage($culture); $feed->setSubtitle($description); $feed->setDescription($description); $params = ""; if ($this->sfReviewType) { $params .= ($params ? '&' : '?') . 'type_id=' . $this->sfReviewType; } if ($this->text) { $params .= ($params ? '&' : '?') . 't=' . $this->text; } $feed->setLink("sfReviewFront/feed{$params}"); $domainExt = $culture == 'ca' ? "cat" : $culture; $feed->setAuthorName("Voota.{$domainExt}"); foreach ($reviews as $review) { $item = new sfFeedItem(); $entityText = ""; if (!$review->getSfReviewType()) { $tmpReview = $review->getSfReviewRelatedBySfReviewId(); $entityText = sfContext::getInstance()->getI18N()->__('otra opinión sobre') . ' '; } else { $tmpReview = $review; } $sfReviewType = SfReviewTypePeer::retrieveByPk($tmpReview->getSfReviewTypeId()); $peer = $sfReviewType->getModel() . 'Peer'; $entity = $peer::retrieveByPk($tmpReview->getEntityId()); $entityText .= $entity; $item->setTitle(sfContext::getInstance()->getI18N()->__('%1%, voota %2% de %3%.', array('%1%' => $review->getAnonymous() ? sfContext::getInstance()->getI18N()->__('anónimo') : $review->getSfGuardUser(), '%2%' => $review->getValue() == -1 ? sfContext::getInstance()->getI18N()->__('en contra') : sfContext::getInstance()->getI18N()->__('a favor'), '%3%' => $entityText))); $item->setLink('sfReviewFront/show?id=' . SfVoUtil::reviewPermalink($review)); if (!$review->getAnonymous()) { $item->setAuthorName($review->getSfGuardUser()); } $item->setPubdate($review->getCreatedAt('U')); $item->setUniqueId($review->getId()); if (!$review->getAnonymous()) { $avatar = S3Voota::getImagesUrl() . '/usuarios/cc_s_' . $review->getSfGuardUser()->getProfile()->getImagen(); } $text = $culture == $review->getCulture() || !$review->getCulture() ? $review->getText() : ''; if (!$review->getAnonymous()) { $img = $review->getSfGuardUser()->getProfile()->getImagen() ? "<img src=\"{$avatar}\" alt =\"" . $review->getSfGuardUser() . "\" /> " : ""; } $content = "{$text}"; $item->setDescription($content); $feed->addItem($item); } $this->feed = $feed; }
private static function addToFeed($feed, $reports) { foreach ($reports as $report) { $item = new sfFeedItem(); $item->setTitle($report->getTitle()); $item->setLink('report/show?id=' . $report->getFriendlyUrl()); if ($report->getsfGuardUser()) { $item->setAuthorName($report->getsfGuardUser()->getProfile()->getFirstname() . ' ' . $report->getsfGuardUser()->getProfile()->getLastname()); $item->setAuthorEmail($report->getsfGuardUser()->getProfile()->getEmail()); } $item->setPubdate($report->getCreatedAt('U')); $item->setUniqueId($report->getFriendlyUrl()); $titles = array(); foreach ($report->getReportQuerys() as $report_query) { $titles[] = $report_query->getTitle(); } //print_r($titles); $item->setDescription(($report->getDescription() ? $report->getDescription() . " " : "") . 'Queries: ' . implode(', ', $titles)); $feed->addItem($item); } }
public function executeFeed(sfWebRequest $request) { $format = $request->getParameter('format'); if ($format === 'atom') { $format = 'atom1'; } elseif ($format === 'rss') { $format = 'rss201'; } $feed = sfFeedPeer::newInstance($format); $feed->setTitle(sfConfig::get('app_rt_blog_title', 'Latest News')); $feed->setLink('http://' . rtSiteToolkit::getCurrentDomain()); $feed->setAuthorEmail(sfConfig::get('app_rt_blog_author_email')); $feed->setAuthorName(sfConfig::get('app_rt_blog_author_name', 'News Editor')); // $feedImage = new sfFeedImage(); // $feedImage->setFavicon('http://'.rtSiteToolkit::getCurrentDomain().'/favicon.ico'); // $feed->setImage($feedImage); $query = Doctrine::getTable('rtBlogPage')->addPublishedQuery(); $query->limit(20)->orderBy('page.id DESC'); $posts = $query->execute(); foreach ($posts as $rt_blog_page) { $item = new sfFeedItem(); $item->setTitle($rt_blog_page->getTitle()); $item->setLink($this->generateUrl('rt_blog_page_show', $rt_blog_page, array('absolute' => true))); $item->setAuthorName($rt_blog_page->getAuthorName()); $item->setAuthorEmail($rt_blog_page->getAuthorEmail()); $item->setPubdate(strtotime($rt_blog_page->getCreatedAt())); $item->setUniqueId($rt_blog_page->getSlug()); $item->setDescription($rt_blog_page->getDescription()); $feed->addItem($item); } $this->feed = $feed; }