Skip to content
Feb 20 / Scotty

CakePHP 1.2 RSSHelper example

There seems to be precious little information out there regarding CakePHP 1.2’s RSSHelper. so here is a quick how-to:

Controller:
function rss() {
$this->layoutPath = 'rss';

$this->Appointment->recursive = 0;

$this->set('data', $this->Appointment->findAll());

$this->set('channel', array('title' => "Recent Appointments",
'link' => "/appointments/rss",
'description' => "Recently Booked Appointments" ));
}

View:

function xformRSS($data)

{

return array('title' => "New Appointment",
   'link' => "/appointments/view/" . $data['Appointment']['id'],
   'guid' => "/appointments/view/" . $data['Appointment']['id'],
   'description' => $data['Appointment']['description'],
   'pubDate' => $data['Appointment']['created']);

}

echo $rss->items($data, 'xformRSS');

Popularity: 22% [?]

One Comment

leave a comment
  1. aeshan / Nov 6 2008

    Hi there,
    I’ve got a problem using the RssHelper as mentioned in your post above.basically I get this Fatal error:
    “Fatal error: Call to undefined method XmlElement::header() in /home/hwz/www/cake/cake1.2.0.7296RC2/cake/libs/view/helpers/xml.php on line 73″
    is something wrong with my Core?is it a beta bug?
    Cheers!
    Aeshan

Leave a Comment