jasonc Posted January 8, 2012 Share Posted January 8, 2012 I have tried sitemap.org and a few others but have not found anything that will give the results I am after. I have a blog site that has a URL and a Description for the URL and wish to have the description show as the anchor text which is linked to the URL, all data is taken from MySQL. Does anyone have a code that will generate something like this ? Quote Link to comment https://forums.phpfreaks.com/topic/254588-can-not-get-rss-feed-to-generate/ Share on other sites More sharing options...
jasonc Posted January 8, 2012 Author Share Posted January 8, 2012 ok I have found a RSS feed code and added it to my file, it work stand alone in an .XML file but how do I get the data from MySQL in to it. When I add .XML to my .htaccess file AddType application/x-httpd-php5 .php .htm .html .xml the page fails with an error Parse error: syntax error, unexpected T_STRING on line 1 <?xml version="1.0" encoding="utf-8"?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <title>Your title goes here</title> <description>Your RSS feed description goes here</description> <link>http://www.rssFeedFolder.com/</link> <language>en</language> <copyright>rssFeedFolder.com</copyright> <pubDate>Fri, 07 Dec 2007 21:58:26 CST</pubDate> <lastBuildDate>Fri, 07 Dec 2007 21:58:26 CST</lastBuildDate> <generator>rssFeedFolder.com</generator> <ttl>30</ttl> <atom:link href="http://www.yourdomain.com/yourfeed.xml" rel="self" type="application/rss+xml" /> <image> <title>Your title goes here</title> <url>http://www.rssFeedFolder.com/images/rssFeedFolderLogo.gif</url> <link>http://www.rssFeedFolder.com/</link> <description>your RSS feed description goes here</description> </image> <item> <title>Your first feed file goes here</title> <description>A brief description of the file goes here</description> <link>http://www.yourdomain.com/rssfeedfolder/file1.html</link> <guid isPermaLink="true">http://www.yourdomain.com/rssfeedfolder/file1.html</guid> <pubDate>Tue, 04 Dec 2007 09:19:42 CST</pubDate> <source url="http://www.rssFeedFolder.com/">rssFeedFolder.com</source> </item> <item> <title>Your second feed file goes here</title> <description>A brief description of the file goes here</description> <link>http://www.yourdomain.com/rssfeedfolder/file2.html</link> <guid isPermaLink="true">http://www.yourdomain.com/rssfeedfolder/file1.html</guid> <pubDate>Web, 05 Dec 2007 10:23:10 CST</pubDate> <source url="http://www.rssFeedFolder.com/">rssFeedFolder.com</source> </item> </channel> </rss> Quote Link to comment https://forums.phpfreaks.com/topic/254588-can-not-get-rss-feed-to-generate/#findComment-1305502 Share on other sites More sharing options...
PFMaBiSmAd Posted January 8, 2012 Share Posted January 8, 2012 Parse error: syntax error, unexpected T_STRING on line 1 That's because your php installation has lazy-way short open tags turned ON. This is the main reason why short open tags have been turned off by default for a while now. The php parser is not smart enough to distinguish the opening <?xml tag from a short opening php tag and the only way to output xml from php code when short open tags are enabled is to echo the opening xml tag. Quote Link to comment https://forums.phpfreaks.com/topic/254588-can-not-get-rss-feed-to-generate/#findComment-1305503 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.