What is RSS feed, and how to generate it?
First of all RSS is an abbreviation for Really Simple Syndication. This abbreviation is used to describe the creating feeds technology. RSS feeds also known as XML or web feeds. This feed is frequently updated content on the website; they are used for notifying interested readers of the news or new posts in the blogs.
RSS benefits not only site owners, but readers and other webmaster.
Site owners' benefits
RSS feeds allow easily syndicate updated content, which can be grabbed by other webmasters and be displayed on their websites. In this case website content gets much more exposure through other websites.
Site webmasters benefits
Feeds allow grabbing frequently updated content from other sites, and always having up-to-date information without actually updating it.
Readers' benefits
Reader can subscribe to RSS feed in their browsers as well on the cell phone. RSS benefits readers giving them an opportunity to be notified once new content was placed on the website they are interested in.
How to create RSS feed using PHP
Basically RSS feed is just a plain text in proper format. Here is a sample RSS generation PHP script
<rss version="2.0">
<channel>
<title>Superior Web Systems</title>
<description>Welcome to our Blog, here you can find news and articles related to the IT industry</description>
<link>http://superiorwebsys.com/</link>
<copyright>2000 - <?=date('Y')?> Superior Web Systems</copyright>
<?
//DB connect file
$link = mysql_connect("localhost", "Data_Base_User", "Password") or die("Invalid query: " . mysql_error());
@mysql_select_db("Data_Base_Name");
//SQL querry
$sSQL="SELECT * FROM blog ORDER BY blogID DESC LIMIT 15"; //Get 15 records from DB
$result=mysql_query($sSQL) or die ("MySQL err: ".mysql_error()."<br />".$sSQL);
while($row = mysql_fetch_array($result))
{
?>
<item>
<title> <?=$row["title"]?></title>
<description><?=str_replace("'","",str_replace("`","",$row['headline']))?></description>
<link>http://superiorwebsys.com/<?=$row["blogID"]?>-<?=$titleForURL?>/</link>
<pubDate> <?=$row['dateCreated']?></pubDate>
</item>
<?
}
?>
</channel>
</rss>
Michael Pankratov