Skip to content

Instantly share code, notes, and snippets.

@padraic
Created December 21, 2009 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save padraic/261291 to your computer and use it in GitHub Desktop.
Save padraic/261291 to your computer and use it in GitHub Desktop.
<?php
require_once 'Zend/Feed/Writer/Feed.php';
/**
* Create the parent feed
*/
$feed = new Zend_Feed_Writer_Feed;
$feed->setTitle('Paddy\'s Podcast');
$feed->setLink('http://example.com');
$feed->setItunesBlock('no');
$feed->addItunesAuthor('Paddy');
$feed->addItunesOwner(array('name'=>'Paddy','email'=>'paddy@example.com'));
$feed->setFeedLink('http://example.com/feed','rss');
$feed->setDescription('Some kind of description.');
$feed->setItunesCategories(array(
'cat1', 'cat2' => array('cat2-1', 'cat2&2')
));
$feed->setItunesImage('http://www.example.com/image.png');
$feed->setItunesDuration('3:45:57');
$feed->setItunesExplicit('clean');
$feed->setItunesKeywords(array('podcast','php','framework','programming'));
$feed->setItunesSubtitle('Podcast subtitle line.');
$feed->setItunesSummary('Podcast summary description.');
$feed->setItunesNewFeedUrl('http://example.com/feed2');
$feed->setDateModified(time());
/**
* Add one or more entries. Note that entries must
* be manually added once created.
*/
$entry = $feed->createEntry();
$entry->setTitle('All Your Base Are Belong To Us');
$entry->setLink('http://www.example.com/all-your-base-are-belong-to-us');
$entry->setDescription('Some kind of description.');
$entry->setItunesBlock('no');
$entry->addItunesAuthor('Paddy');
$entry->setItunesDuration('3:45:57');
$entry->setItunesExplicit('clean');
$entry->setItunesKeywords(array('podcast','php','framework','programming'));
$entry->setItunesSubtitle('Podcast subtitle line.');
$entry->setItunesSummary('Podcast summary description.');
$feed->addEntry($entry);
/**
* Render the resulting feed to RSS 2.0
*/
$out = $feed->export('rss');
echo $out;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment