27 Sep 2003
Using the upcoming.com RSS feeds in MT
Update: For a more robust solution, check out “Using Upcoming.org’s Extended RSS Feed” and the category-calendar I wrote for Gothamist.
Since I haven’t seen any tutorials on using the new upcoming.org RSS feeds with MovableType, I thought I’d post the steps I followed.
- Download and install the RSS Feed MT plug-in.
- Use the following code in your Main Index template (ex, insert it in a sidebar on your front page):
<MTRSSFeed file="http://upcoming.org/syndicate/my_events/XXX";> <b>Upcoming.org</b> (<a href="<$MTRSSFeedLink$>">profile</a>)<br/> <MTRSSFeedItems> <a href="<$MTRSSFeedItemElement name="guid"$>" <MTRSSFeedItemDescriptionExists> title="<$MTRSSFeedItemDescription$>" </MTRSSFeedItemDescriptionExists> ><$MTRSSFeedItemTitle$></a><br/> </MTRSSFeedItems> </MTRSSFeed>
In the RSS feed URL in the <MTRSSFeed> tag, replace “XXX” with your user id from upcoming.org (I’ll take this opportunity to brag that I managed to grab a user id < 100). <$MTRSSFeedLink$> automatically provides the link to your user profile on upcoming.org (as long as their current RSS feed format stays the same).
The RSS feed is pretty straightforward (with item titles and descriptions), except that there aren’t any “link” item elements. So you need to use <$MTRSSFeedItemElement name=”guid”$> to grab the URL to the individual event page.
- Alternatively, you can (like me) create a new index template (named “upcoming.org”) with the code above to create a simple text file to use as a page include.
- If you have the IfEmpty plugin installed, you can use the following line of code in your template for times when there are no events on your upcoming.org list: (insert this right before <MTRSSFeedItems>)
<MTIfEmpty expr="[MTRSSFeedItems]1[/MTRSSFeedItems]"> No current events. </MTIfEmpty>
- So that your event list stays in sync with upcoming.org in-between rebuilding after publishing new entries, comments, etc; you can install MT-Rebuild to rebuild your Main Index template (or your simple page include template) every hour using a cron job.
Now I just have to come up with a new front page design so I can shoehorn in more side bar elements.
This kicks ass. I’ll probably link to this on Upcoming.org next week.
Andy Baio | 27 Sep 2003