Web Hosting Talk







View Full Version : RSS


Danny159
04-07-2009, 05:38 AM
Hey,

Someone has asked me to make something that is simple if you know how to do it... but I am not sure on it,

I need to create an RSS feed from an mySQL database then use the feed to feed the news page on the website but only the top 5 stories.... Can someone explain with examples how I do this?

As its very confusing!

Dan

lebnene
04-08-2009, 08:14 AM
Here is a very good step by step tutorial to accomplish this: http://www.webreference.com/authoring/languages/xml/rss/custom_feeds/

mwatkins
04-08-2009, 12:10 PM
The webreference link will only get you so far. I note it doesn't talk at all about the *format* of the content. If you are going to be pulling out HTML content from your site/db, you need to know how to present that in the resulting XML (RSS).

I don't much like RSS myself, preferring the more complete and consistent Atom format, but sometimes you don't have a choice (or can support both).

That said if you are going to write RSS:

1) First model it by hand - create a RSS file with sample content; it'll be your base line.

2) VALIDATE that baseline http://feedvalidator.org/

3) Implement your DB-driven solution; use the SPECS - when writing code to comply with an established specification, always, always, consult the established specification. The article linked above didn't even mention the spec. Shame. http://cyber.law.harvard.edu/rss/rss.html

4) VALIDATE your DB-driven solution. You have the link.

5) TEST and RETEST. Throw some hardballs at your solution. Put in some odd characters into each of the fields. Can you handle unicode / utf-8 or other encodings?