Scott Donnelly

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');