RE: Package thoughts: XML_RSS_Publisher
| From: | David Ashwood | Date: | Mon, 17 Jan 2005 20:34:42 +0000 |
| Subject: | RE: Package thoughts: XML_RSS_Publisher | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-35553@lists.php.net to get a copy of this message | ||
Cool - thanks for the prompt info Lucas,
First - I gotta apologise for the excess messages - Outlook decided to throw
a Benny, things went pear shaped (pardon the pun) for a bit :(
The main processing engine would be use the XML_Serializer - that's what I'm
using at the moment - and why reinvent the wheel?
Currently I'm building a hash of categories - either statically or via a
database.
The Database side of things uses a subclass of DB_DataObject and uses
defined links to pull extra items - if necessary.
As nothing existed within PEAR already - I thought I'd wrap it up and define
an interface.
David
-----Original Message-----
From: Lukas Smith [mailto:lsmith@php.net]
Sent: Monday, January 17, 2005 9:22 PM
To: David Ashwood
Subject: Re: Package thoughts: XML_RSS_Publisher
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