Ever wondered how to build an RSS XML feed from your site using PHP? In this article Mitchell explains what RSS is, and steps you through building a generic RSS generating class with PHP and MySQL.
Building a Generic RSS Class With PHP - Testing Our Class (Page 5 of 6 )
Testing our class is easy. It should be separated into its own file, class.myRSS.php. You should use PHP to include this file and output the value from the GetRSS function. Once you’ve done this, any other Webmaster can grab and parse your RSS XML feed to display your headlines on their site, and you can also submit the link to your RSS file to RSS listings to drive an insane amount of traffic back to your site.
Here's a quick example. Save it as rss.php in your root directory on your web server, along with class.myRSS.php and modify it as you need to:
include("class.myRSS.php");
// Instantiate the myRSS class $myRSS = new myRSS;
$myRSS->channelTitle = "My sample channel"; $myRSS->channelLink = "http://www.mysite.com"; $myRSS->channelDesc = "My sample RSS XML channel";