Gena01.com Forum
December 11, 2017, 12:29:02 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Tags Login Register  
Pages: [1]
  Print  
Author Topic: Updated RSS feeds  (Read 23528 times)
0 Members and 1 Guest are viewing this topic.
Gena01
Administrator
Sr. Member
*****
Posts: 423



WWW
« on: February 24, 2008, 09:14:30 pm »

I have updated and fixed up the RSS feeds for my website. There's actually two feeds: blog and news. Blog feed is built on the core SMF functionality. Recently while testing some things I noticed that my blog feed was showing last number of posts and not the threads that were posted on the blog board. It seems that SMF has quite a few options for generating XML feeds.

You can see the options documented here: http://www.simplemachines.org/community/index.php?topic=25009.0

The only thing missing (so far) is a way to generate an RSS feed based on the tags, but I already got an idea of how to put it together.

The news feed was something that I coded by hand and is based on the scripts that i've used and rewritten a number of times for my website. The back-end is stored in an XML file and over the years i've used different tricks to parse the news items. One of my last experiments was using XSL files to do the transformation. One problem I ran into was the fact that my news feed was missing date/time information when the articles were posted. Apparently I was using a different date format than the one that RSS uses.  After a few minutes of considering my options I rewrote the whole thing in PHP using 5.x XML functionality.

The script in PHP was amazing and quite simple. I parse the file using SimpleXML and then convert the date using PHPs date function. The date conversion was probably the simplest of them all:
   date(DATE_RSS, strtotime($date));

So kudos to PHP core developers for creating a nice and simple way of generating RSS feeds in a couple of lines of PHP code.

P.S. One small gotcha with generating XML feeds and having short tags enabled is a way to get this to play nice with the PHP parser. One trick I pulled out of PHP documentation/manual is to print "<?xml".. inside PHP.

Gena01
Logged
Gena01
Administrator
Sr. Member
*****
Posts: 423



WWW
« Reply #1 on: February 24, 2008, 09:50:37 pm »

Just to add to the above post it seems that different browsers handle RSS feeds differently and inconsistently. While testing things IE6 doesn't show available RSS feeds. IE7 shows RSS feeds, but it shows them in a place that is not obvious (I was expecting it to show the same way Firefox does). IE7 also has quite nice stylesheet to present the RSS feed in a readable way. Firefox 2.x on the other hand has a horrible horrible stylesheet that has a lot of problems and some open bugs.

I have added RSS icons so the feeds are easier to find.

Gena01
Logged
Tags: SMF  blog rss  php  rss 
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines | Sitemap Valid XHTML 1.0! Valid CSS!