Tiffany B. Brown

A web log about web development and internet culture with frequent detours into other stuff.
Keeping it simple
A9.com

Now with (validated!) RSS!

I’ve been meaning to create an RSS feed for my site for quite some time now. Today, I jumped in and did it.

I confess I cheated a bit by hijacking the basic code from a Search Engine Watch article on creating RSS feeds.

But I still had to figure out how to automate the updating of the feed. Enter my old friend PHP and the magic Apache directive AddType.

I created a new directory (feeds), then created an .htaccess file in that directory with the following line: AddType application/x-httpd-php .xml. That lets the server know to parse X M L files in that directory as PHP files.

A few database calls later, and I’ve got a dynamically-generated RSS feed available for your pleasure.

You will need an aggregator, however. If you’re on a Windows box with Mozilla installed, I’d like to suggest Newsmonster. You’ll also need the latest version of Java.

Or try a service like Kinja

UPDATE: Now your browser will recognize it as an XML document, and your news reader will recognize it as a valid RSS feed. I had to modify the code a smidge, adding header("Content-type: text/xml"); to the script, stripping out HTML tags, and converting special characters.

Share this entry:
  • TwitThis
  • Digg
  • Technorati
  • del.icio.us
  • Ma.gnolia
  • Mixx
  • NewsVine
  • Reddit
  • StumbleUpon
  • TailRank
  • Furl
  • Slashdot
  • Global Grind
  • YahooMyWeb
  • Facebook
  • Google
  • Live
  • LinkedIn
  • MySpace
Comments are closed.
previous post: Keeping it simple
next post: A9.com