Re: Package thoughts: XML_RSS_Publisher
| From: | Lukas Smith | Date: | Mon, 17 Jan 2005 20:21:38 +0000 |
| Subject: | Re: Package thoughts: XML_RSS_Publisher | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-35552@lists.php.net to get a copy of this message | ||
David Ashwood wrote:
Howdy, I'm in the middle of a project for a client who desires to publish RSS feeds. I was wondering if people thought it would be a useful addition to PEAR? The package would publish dynamic feeds (from a data source) and generate/manage static feeds - and would be loosely coupled with PEAR::Cache. Optionally I'd also like access to feeds to be support authentication and maybe authorisation - should it be possible to devise a suitable framework. Any thoughts?I have been using XML_Serializer for this purpose with alot of success. It just takes a few config options ... The following code is taken from a recent workshop on PEAR:
public static function toRSS ( $list )
{
$data = array(
'channel' => array(
'title' => 'My Ebay items',
'link' => 'http://www.ebay.de'
)
);
foreach ($list as $item) {
$data['channel'][] = $item->getData();
}
$serializer_options = array (
'addDecl' => TRUE,
'encoding' => 'ISO-8859-1',
'rootName' => 'rss',
'rootAttributes' => array(
'version' => '2.0'),
'defaultTagName' => 'item'
);
$serializer = new XML_Serializer($serializer_options);
$serializer->serialize($data);
return $serializer->getSerializedData();
}
regards,
Lukas