1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| class feedActions extends sfActions
{
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
$this->forward('default', 'module');
}
public function executeLastPost()
{
$feed = new sfAtom1Feed();
$feed->initialize(array(
'title' => 'The mouse blog',
'link' => 'http://www.comtuer.local/',
'authorEmail' => 'pclive@myblog.com',
'authorName' => 'Peter Clive'
));
$posts = Doctrine::getTable('Post') ->createQuery('a')
->execute();
foreach ($posts as $post)
{
$item = new sfFeedItem();
$item->initialize(array(
'title' => $post->getTitle(),
'link' => 'http://www.comtuer.local/feed?stripped_title='.$post->getStrippedTitle(),
'pubDate' => $post->getCreatedAt(),
'uniqueId' => $post->getStrippedTitle(),
'description' => $post->getDescription(),
));
$feed->addItem($item);
}
$this->feed = $feed;
$this->setLayout(false);
}
} |
Partager