brent123456 Posted July 11, 2007 Share Posted July 11, 2007 I can seed to get anything more then the Title and the Description to print out in Firefox and IE. I can't for the life of me figure out why? I am not getting any of the items to print out in the Browser under the title and discriptions. Please help. I add this line to the apache configure file AddType application/x-httpd-php .xml and restarted and still nothing. This is driving me nuts please help. ??? <?php require_once ('mysql_connect.php'); //connection page $query ="SELECT * FROM product_table ORDER BY date_Posted DESC LIMIT 0,2"; $rsstitle = 'The Products'; $rssdesc = 'View the newest Products'; $rsslink = 'http://www.example.com; if ($result = mysql_query($query)) { header("Content-Type: application/xml; charset=ISO-8859-1"); $output .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; $output .= "<rss version=\"2.0\">\n"; $output .= "<channel>\n"; $output .= "<title>".$rsstitle."</title>\n"; // the title of the feed $output .= "<description>".$rssdesc."</description>\n"; // small description $output .= "<link>".$rsslink."</link>\n"; $output .= "<product>\n"; while ($row = mysql_fetch_assoc($result)) { $output .= "<item>\n"; $output .= "<title>\n" . htmlentities(strip_tags($row['name'])) . "</title>\n"; $output .= "<date>" . htmlentities(strip_tags($row['date_Posted'])) . "</date>\n"; $output .= "<type>" . htmlentities(strip_tags($row['product_type'])) . "</type>\n"; $output .= "<environment>" . htmlentities(strip_tags($row['environment'])) . "</environment>\n"; $output .= "<discription>" . htmlentities(strip_tags(substr($row['discription'],0,140))) . "</discription>\n"; $output .= "</item>\n"; } $output .= "</product>\n"; $output .= "</channel>\n</rss>\n"; echo $output; } else { $output .= 'Sorry, We can't get a product at this time.'; echo $output; } ?> This is what it has when i view page source <?xml version="1.0" encoding="utf-8"?> <rss version="2.0"> <channel> <title>The Products</title> <description>View the newest Products</description> <link>http://www.example.com</link> <strains> <item> <title> Chain Saw</title> <date>2007-07-08</date> <type>Outdoors</type> <environment>Outdoors/Wood Products</environment> <discription>Great New Chain Saws</discription> </item> Quote Link to comment Share on other sites More sharing options...
brent123456 Posted July 11, 2007 Author Share Posted July 11, 2007 Figured it out. You can only have tags that are recognized by rss. Like <item> <title></title> <pubDate></pubDate> <discription></discription> <link></link> </item> It is not like XML and won't read your custom tags. Once I added these all was fine. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.