Code: Select all
<?php
// Let us first make sure the php file is
// interpeted as xml information
echo '<?xml version="1.0" encoding="ISO-8859-1" ?>';
// SQL connection
$query = "SELECT * FROM mos_content ORDER BY (id) DESC";
$res = mysql_query($query);
$num = mysql_num_rows($res);
if($num == 0)
{
exit;
}
else
{
// First we print the overall xml information
// First we print the overall xml information
echo "<rss version=\"2.0\">\n";
echo "<channel>\n";
// Here comes the global title for you rss
echo "<title>My newsfeed</title>\n";
// Here comes the url for the page that the rss applies for
echo "<link>http://www.pspcave.com/</link>\n";
// Here comes a short description of the page
echo "<description>BzaBlog Newsfeed</description>\n";
// Now over to the dynamic part
while($sql = mysql_fetch_object($res))
{
$blog_title = stripslashes($sql->title);
$blog_link = "blog.php?ID=".$sql->id;
$blog_description = stripslashes($sql->introtext);
echo "<item>\n";
echo "<title>".$blog_title."</title>\n";
echo "<link>".$blog_link."</link>\n";
echo "<description>\n";
echo $blog_description;
echo "</description>\n";
echo "</item>\n";
}
// And at last the closing tags for the overall info
echo "</channel>\n";
echo "</rss>\n";
}
?>dont laugh at me if i done it totally wrong etc.