Saturday, October 11, 2008

It’s been a long road

getting from there to here…

Friends 2.0

I promise this will be the end since there isn't much else I can do to the friends page. But I finally achieved what I set out to do in 2005 when I created the friends page. Starting from a set of rss links, the friends page achieves what Livejournal does by listing posts made by your friends in the order in which they were posted. LJ accomplishes this by storing posts on its server which it can read in order, but it's a bit of a feat to do it from nothing but a few rss links. I give you unlimited entries up until a week. If you haven't posted in more than a week, your last entry is truncated at the bottom in purple. It's all displayed in order by post date and it's awesome.

The page works through with the basic logic:

Define friends array with rss links, names, homepage
For each friend in the array, find all the posts in the last week -> each post is added to separate "posts" array
Sort that array of posts by date
Print the sorted array of posts

Sorting the array was the big problem solved today. Starting with the initial friends array in version 1.5 really did make this possible after all. It's easy to add/remove friends and the script handles everything! Of course there is a lot of error handling there too since RSS feeds are very flexible. Since you've probably already read about everything already I'll stop posting about it now. If anyone cares to to see the different versions of the site as it evolved:

0.9 - 1st edition, loading of first RSS post from each user
1.0 - Error handling if RSS feed not found, page went live, cosmetic changes
1.1 - Added History feature
1.2 - First Color support = red table if rss error, title moved to blue area of table
1.3 - Support for ['Content']['Encoded'] in place of description
1.4.2 - Script detects post age, homepage link changed to username, script assigns table color based on age, hides 2 week old entries, removed table border, changed default charset to UTF-8 to fix '?' issue, added leftmenu
1.5 - Friends Array added, rss image support w/failsafe
2.0 - Friends Sort by post date
2.1 - Multiple posts by one author, 4 posts by friends up to two weeks
Posted by eclipse on 10/11/2008 at 12:15 AM
Internet • (1) CommentLink to this entry