Rapid Application Development with Open Source Software

Next: Cakephp 2.x: Building a Newsletter infrastructure UP: TOC

The View for the RSS Feed is described below.

set('documentData', array('xmlns:dc' => 'http://purl.org/dc/elements/1.1/'));
$this->set('channelData', array('title' => __("Logikfabrik News"),'link' => $this->Html->url('/', true),
   'description' => __("Recently changed chapters on logikfabrik.com"),'language' => 'en-us'));

foreach ($recent as $c) {
    $postTime = strtotime($c[0]['modified']);

    // This is the part where we clean the body text for output as the description
    // of the rss item, this needs to have only text to make sure the feed validates
    $bodyText = 'Chapter: ' . $c[0]['title'] . '
'; $bodyText .= 'Book: ' . $c[0]['name'] ; $bodyText = preg_replace('=\(.*?\)=is', '', $bodyText); $bodyText = $this->Text->stripLinks($bodyText); $bodyText = Sanitize::stripAll($bodyText); $bodyText = $this->Text->truncate($bodyText, 400, array( 'ending' => '...','exact' => true,'html' => true, )); echo $this->Rss->item(array(), array( 'title' => $c[0]['title'], 'link' => $this->Html->url('/books/'. $c[0]['book_id'] . '/' . $c[0]['name'] . '/' . $c[0]['id'], true), 'guid' => array('url' => $this->Html->url('/books/'. $c[0]['book_id'] . '/' . $c[0]['name'] . '/' . $c[0]['id'],true), 'isPermaLink' => 'true'), 'description' => $bodyText,'pubDate' => $c[0]['modified'] )); }
Next: Cakephp 2.x: Building a Newsletter infrastructure UP: TOC