[EXTENSION] Webfeed

The webfeed extension lets you create RSS 1.0, RSS 2.0 and Atom 1.0 webfeeds. The classes follow the specifications as close as possible. No extensions are implemented yet (TODO). Also, it could be converted into an application module (TODO)

http://www.yiiframew…tension/webfeed

Please try it and post your comments, doubts and but reports here. Collaborations are welcomed.

I tried the example from the doc but:

Use of undefined constant RSS_0_91 - assumed 'RSS_0_91'

class constructor of RSS_0_92  is named "__construct__construct"

I did't get this to work

implemented feedcreator instead

Updated to 1.0b (fixed the typo in the RSS 2.0 constructor and updated the example for RSS 2.0 since the posted came from an older version) Should work now :)

The same error remains. More over, there are several errors, there is no definition about RSS_1_0 for instance.

Quote

I did't get this to work

implemented feedcreator instead

Yeah, feedcreator works fine to me.

@MetaYii

Hi,

I have made a few changes to EWebFeed (Zip file attached).

  • Fixed a bug with entry->summary in the Atom feed (in Atom_1_0::generateXML)

  • Implemented the RSS Advisory Board Namespace Elements http://www.rssboard.org/rss-profile#namespace-elements.

  • Implemented RSS 2.0.11 (this was only a documentation change so is only sets the docs attribute - not exactly the most difficult code ever :rolleyes:

  • Feeds now return objects when things are added to them (e.g. an item to an RSS feed); this allows the application to work on the object directly rather than via an array in the feed itself.

So the example in the documentation:




$feed->addItem('item 1', 'http://www.microsoft.com/', 'Mocosoft');

$feed->items[0]->pubDate = time()-86400;



becomes:




$item = $feed->addItem('item 1', 'http://www.microsoft.com/', 'Mocosoft');

$item->pubDate = time()-86400;



  • I changed the way the feed is instantiated. Rather than passing EWebFeed an IFeedGenerator object, e.g.



$feed = new EWebFeed(new RSS_2_0("Hello", "Hello world", "http://www.kernel.org/"));



I get EWebFeed to instantiate the generator object based on the type asked for and pass it a parameter array, e.g.




$feed = new EWebFeed('RSS_2_0_11', array(

	'title' => 'EWebFeed',

	'description' => 'A web feed',

	'link' => 'http://example.com',

));



This also has the benefit of allowing EWebFeed to only load the generators it needs for the given feed, rather than as currently loading everything.

I hope the above is of interest and help.

Regards,

Chris

@sdietz: what’s your php.ini’s display_errors setting?

Is Web feed extension compatible with Yii 1.1.x?

Is there some SVN version?

Hi MetaYii,

sorry to say that, but the others are right.

Basically I think the extension looks very well, much better than Zend_Feed, but I needed about 2-3 hours to get it working.

If you’re still developing this extension (I hope so), please check the attachment. You may diff it with your current version.

I made a few hotfixes, just to get it running … RSS 2.0 only, btw: my dev-machine runs on E_STRICT.

Best regards,

schmunk