Using a PHP class to generate RSS feeds

February 7th, 2007 by Paul

Here’s a good starting point for generating numerous RSS feeds from your databased content. The image below is a screen snap of my sample class, I’ll include some basic instruction below that.

Use your class like this:

include(”class.RSS.php”);

// set global vars
$RSSoutpath = “server path, not url”;
$RSStitle = “feed title”;
$RSSdesc = “feed description”;
$RSSurl = “url to feed”;
$RSSdebug;

// initiate the class
$makefeed = new genRSS();

// loop through your database content to generate items using makeItem()
$makefeed->makeItem(’url’,'title’,'description’);

// create the final output file
$makefeed->makeOutfile();

echo $RSSdebug;

Comments are closed.