Hi Jesse,
It's actually quite straight forward. Assuming that you're OK with the database code (it's no different in a page that generates a feed to any other page) - the following should help get you started...
PHP Code:
<?php
// set the content type header to XML
header("Content-Type: text/xml");
// print the XML declaration
print "<?xml version='1.0' encoding='UTF-8'?>";
// print RSS header and channel info
print "<rss>";
print "<channel>";
print "<title>Your Feed Title</title>";
// now query your database to extract the items you want in
// the feed into an array called, for example, $items
foreach($items as $item)
{
print "<item>";
print "<title>".htmlentities($item["title"])."</title>";
print "<link>".htmlentities($item["link"])."</link>";
print "<description>".htmlentities($item["description"])."</description>";
print "</item>";
}
print "</channel>";
print "</rss>";
?>
This would create a feed with the minimum required fields, but you could add all sorts of other information. The Wikipedia page is a good reference for the format:
http://en.wikipedia.org/wiki/RSS_(file_format)
Hope this helps!
Bookmarks