Skip to content

Instantly share code, notes, and snippets.

@brettstimmerman
Created July 22, 2009 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettstimmerman/152245 to your computer and use it in GitHub Desktop.
Save brettstimmerman/152245 to your computer and use it in GitHub Desktop.
<?php
function getItems() {
$items = array();
// Get items from somewhere
return $items;
}
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
?>
<rss version="2.0">
<channel>
<title>Simple RSS 2.0 Feed</title>
<link>http://www.example.com</link>
<description>Simple RSS 2.0 Feed</description>
<?php foreach(getItems() as $item): ?>
<item>
<title><?php echo $item['title']; ?></title>
<link><?php echo $item['url']; ?></link>
<description><?php echo $item['description']; ?></description>
<pubDate><?php echo date('r', $item['date']); ?></pubDate>
</item>
<?php endforeach; ?>
</channel>
</rss>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment