Hello David,
1. The rss.php could not create link in Firefox. But is ok in IE. Also it didn't show the title.
2. Is it possible to create rss for category or brand.
thanks.
below is the rss.php code
<?php
require("includes/common.php");
Header('Content-Type: application/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
echo '<?xml-stylesheet href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"?>' . "\n";
echo '<!-- RSS for ' . $config_title . ', generated on ' . date(r) . ' -->' . "\n";
$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` ORDER by merchant";
?>
<rss version="0.92">
<channel>
<title><?php echo $merchant; ?></title>
<link><?php echo $base_url;?></link>
<description><?php echo $store_desc; ?></description>
<webMaster><?php echo $email_address; ?></webMaster>
<language><?php echo $lang_code; ?></language>
<lastBuildDate><?php echo date(r); ?></lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<?php
if (database_querySelect($sql,$rows))
{
$sitemapBaseHREF = "http://".$_SERVER["HTTP_HOST"].$config_baseHREF;
foreach($rows as $row)
{
echo '<item>' . "\n";
echo ' <title>' , $row["merchant"] , '</title>' . "\n";
echo ' <link>' . $sitemapBaseHREF . "merchant/" . tapestry_hyphenate($row["merchant"])."/" . '</link>' . "\n";
echo ' <description>' , $row["merchant"] , '</description>' . "\n";
echo '</item>' . "\n";
}
}
?>
</channel>
</rss>
Hi David
Im using the script above but keep getting loads of the following in our error logs
PHP Notice: Use of undefined constant r - assumed 'r' in the following line:
<?php
echo date(r);
?>
Will simply replacing (r) ('r') fix this or is more required?
Chris
Hi Chris,
That's correct - it should be in quotes (single or double will do!)
Cheers,
David.
Hi,
Can you perhaps post a link as I'm not quite sure what you mean by not being able to create a link in Firefox. I run Firefox primarily so i'll have a look for you.
With regards to creating a feed for brands and categories; - in each case, simply change:
$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` ORDER by merchant";
to:
$sql = "SELECT DISTINCT(category) AS category FROM `".$config_databaseTablePrefix."products` ORDER BY category";
...or:
$sql = "SELECT DISTINCT(brand) AS brand FROM `".$config_databaseTablePrefix."products` ORDER BY brand";
...and then in the main loop, simply replace each instance of "merchant" with either "category" or "brand" for each of the new scripts. Call them something appropriate like "rssCategory.php" and "rssBrand.php" in order to keep them separate...
Cheers,
David.