RSS Feed is one of the best thing in modern web world. But most of the time we are not able to create our own RSS Feed. But can you imagine its simply easy when you know how to write them. Here is a beganing example to write a RSS Feed:
<?php
header( ‘Content-type: text/xml’);
?>
<rss version=”2.0″>
<channel>
<title> WordPress </title>
<description> This is a test site for WordPress </description>
<link> phpprogrammerofbangladesh.wordpress.com </link>
<?php
mysql_connect( ‘localhost’, ‘root’, ” ) or die( mysql_error() );
mysql_select_db( ‘wordpress’) or die( mysql_error() );
$sql_query = “select ID, post_date, post_title, post_content from wp_posts ORDER BY post_date DESC LIMIT 0,5”;
$result = mysql_query( $sql_query );
while( $row = mysql_fetch_row( $result ) )
{
?>
<item>
<title> <?=htmlentities(strip_tags($row[2]));?> </title>
<description> <?=htmlentities( strip_tags($row[3]) );?> </description>
<link> http://localhost/wordpress/index.php?post_id=<?=$row[0];?> </link>
<pubDate> <?=$row[1];?> </pubDate>
</item>
<?php
}
?>
</channel>
</rss>
You can have more details about RSS Feed Creation from the following links