surfsup Posted November 8, 2007 Share Posted November 8, 2007 First time attempting to do this ie create a dynamic rss feed. Hoping someone can have a look at the below. I just can't seem to get it to work. Specifically i get a parse error on line 35 when in FF. When i check url in a reader it shows no items <?php header("Content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; // Set RSS version. echo " <rss version=\"2.0\"> "; // Start the XML. echo " <channel> <title>Caravanorcamper.com News</title> <description>Caravan or Camper is a drectory and networking site of rental firms and indivduals across the globe.</description> <link>http://www.caravanorcamper.com/</link>"; // Create a connection to your database. require("includes/connect.php"); // Query database and select the last 10 entries. $data = mysql_query("SELECT * FROM web_rss_items ORDER BY id DESC LIMIT 10"); while($row = mysql_fetch_array($data)) { // Convert database images data into actual image link. $row[description] = str_replace("images/", "http://www.caravanorcamper.com.au/images/", $row[description]); // Continue with the 10 items to be included in the <item> section of the XML. echo " <item> <link>http://www.caravanorcamper.com/article.php?id=".$row[id]."</link> <guid isPermaLink=\"true\">http://www.caravanorcamper.com/article.php?id=".$row[id]."</guid> <title>".$row[Title]."</title> <description>".$row[description]."</description> </item>"; } // substr can limit the number of characters. First number is starting point while the second number is number of // otherwise just use $row[description]. // <guid> is an optional sub-element of <item> but recommended if you don’t want to receive a echo " </channel> </rss>"; ?> 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.