Creating an RSS FEED
Posted: Wed Aug 20, 2008 5:52 pm
http://validator.w3.org/feed/check.cgi? ... 2Ffeed.rss = my validation. don't really understyand what is wrong with it.
help please.don't know what iswrong.
my code:
help please.don't know what iswrong.
my code:
Code: Select all
//create rss feed
$str = '<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>';
$result = mysql_query("SELECT * FROM themes WHERE pending='n' ORDER BY id DESC LIMIT 10");
while($themes = mysql_fetch_object($result))
{
$descr = '<div class="entry">
<p>
<img src="images/arrow.png" alt="" /> Name: <a href="' . $siteURL . "/themes/" . $themes->id . "/" . clean_url($themes->name) . '/">' . $themes->name . '</a><br />
<img src="images/arrow.png" alt="" /> Author: <a href="' . $siteURL . "/author.php?id=" . $themes->username . '">' . $themes->username . '</a><br />
<img src="images/arrow.png" alt="" /> Categories: ' . theme_cats($themes->id) . '<br />
<img src="images/arrow.png" alt="" /> Properties: <br />' .
theme_properties($themes->id) . '
</p>
<div class="demo">';
if(!is_dir("../testrun/wp-content/themes/$themes->id/"))
{
$descr .= 'Demo (#)';
} else
{
$descr .= '<a href="' . $siteURL . '/testrun/index.php?preview_theme=' . $themes->id . '" target="_blank" class="style1">Demo (#)</a>';
}
$descr .= '</div> ';
$str .= "
<item>
<title>$thems->name WP Theme</title>
<link>" . $siteURL . "/themes/" . $themes->id . "/" . clean_url($themes->name) . "</link>
<guid>" . $siteURL . "/themes/" . $themes->id . "/" . clean_url($themes->name) . "</guid>
<pubDate>" . date("D M j G:i:s T Y") . "</pubDate>
<description>[CDATA[ " . $descr . " ]]</description>
</item>";
}
$str .= '</channel>
</rss>';
$fp = fopen('../feed.rss', 'w');
fwrite($fp, $str);
fclose($fp);