php - Why does this XML not render in the browser the way I want? -
i want use php create rss mysql. can see content in page source code. can not see item part in web browser(ie, firefox or opera). web browser show
`your rss feed name or website name
a description of feed or site.`
<?php require_once ('mysql_connect.php'); //set xml header header('content-type: text/xml'); //construct rss feed headers $output = '<rss version="2.0">'; $output .= '<channel>'; $output .= '<title>your rss feed name or website name</title>'; $output .= '<description>a description of feed or site.</description>'; $output .= '<link>http://www.yoursite.com/</link>'; $output .= '<copyright>your copyright details</copyright>'; //body of rss feed mysql_select_db("rss", $db); $result = mysql_query("select * rss limit 15",$db); while ($row = mysql_fetch_array($result)) { $output .= '<item>'; $output .= '<title>'. $row['title'] .'</title>'; $output .= '<description>'. $row['content'] .'</description>'; $output .= '<link>'. $row['link'] .'</link>'; $output .= '<pubdate></pubdate>'; $output .= '</item> '; } mysql_close($db); //close rss feed $output .= '</channel>'; $output .= '</rss>'; //send complete rss feed browser echo($output); ?>
the xml source looks like:
<rss version="2.0"> <channel> <title>your rss feed name or website name</title> <description>a description of feed or site.</description> <link>http://www.yoursite.com/</link> <copyright>your copyright details</copyright> <item> <title>milan, italy - september 26: models walk runway @ emi&hellip</title> <description>date: sep 26, 2009 7:45 pmnumber of comments on photo:0view photo…</description> <link>http://picasaweb.google.com/roxyluvtony/kendraspears#5551895410815389042</link> <pubdate></pubdate> </item> ... </channel> </rss>
moving comment answer...
it's not valid xml because of …
entity in <title>
, <description>
nodes.
wrap strings <![cdata[tag]]>
, try again.
Comments
Post a Comment