Archive

Archive for May, 2009

Adding an RSS Feed to a Data-Driven Website

One of the things I love about Bluyah is how quickly it can solve a variety of feature requests made of an application.  As an IT professional, I’m constantly weighing the time it will take to develop an application feature against the benefit that feature will provide to the end-users.  In some cases it comes down to simple math: will it cost our company more (in terms of a developer’s salary) than this feature will return (in terms of revenue)?  In other cases it’s much more subtle - especially when dealing with web properties that don’t have a straight-forward revenue model.

Case in point: Pif Magazine (www.pifmagazine.com).  

Pif Magazine has been online for nearly 15 years now.  It is one of the oldest, continually published literary journals on the Net.  It has published original works by well-known authors like Julia Slavin, Amy Hempel, and Poet Laureate  David Lehman.  It has also introduced countless unknown, previously unpublished authors and poets who have, because of their exposure in Pif, gone on to land contracts with traditional publishers.

In short, it’s an important venue with a very dedicated following.

One thing it is not, however, is technologically up-to-date.  The content management system used by the editorial staff is a highly customized version of PHP-Nuke 5.2 (codenamed: SIDney), which was deployed in the spring of 2001 and, save a few minor visual enhancements, has not been upgraded since.  It may sport a robust publication contracting system, but it lacks basic modern features. 

So when the editorial team recently asked me to add RSS capabilities to the site so they could syndicate the newly published articles, my first reaction was: “Well, there goes my weekend.”  Then, just as quickly I realized: “Hey - I can do this in Bluyah in about 3 minutes.”

Step 1: Getting the Data

This first step is always the most difficult.  Every application has it’s own database schema and SIDney is no different.  Only with SIDney, the schema is complicated by the fact that author information is (for historical reasons) stored in a separate database from article information.  In addition, the author’s email address is stored in a separate table from the author’s first and last name.  Just to complicate matters even more, the SIDney application allows editors to control things like title wrapping with special comment tags.  

To work around all of these inconveniences, I decided that the easiest way to gain access to all of the data bits I needed for an RSS feed would be to create a database view against the articles database and then point Bluyah at this view.

The view structure looks similar to this:

CREATE OR REPLACE SQL SECURITY INVOKER VIEW PIF_RSS_VIEW AS
SELECT
    CONCAT('http://www.pifmagazine.com/SID/',s.sid) AS link, 
    REPLACE("<!--titlebreak-->"," ") AS title,
    REPLACE(REPLACE(s.hometext,"\\'","'"),'\\"','') AS description, 
    s.pubdate,
    t.topictext, t.topicname,
    us.username as email,
    CONCAT(ui.fname,' ',ui.lname) AS author,
    ui.city, ui.state, ui.zipcode
FROM ARTICLE.stories s
    JOIN ARTICLE.topics t ON (s.topic=t.topicid)
    JOIN USER.user us ON (s.uid=us.uid)
    JOIN USER.userinfo ui ON (us.uid=ui.uid) 
ORDER BY s.pubdate DESC
LIMIT 20

Once the database view was defined and created, the rest was a snap.

Step 2: Connecting to the View

In Bluyah, I already had a Database Connection created for the Pif Magazine database.  I just needed to “discover” the newly created view and user it in a report.  To discover the view, I went to the Connect tab, found the already existing connection, then clicked on the “List DB Tables/Views” link in the Action column:Link DB Tables/Views
This will bring up a list of all tables and database views in your database.  Finding the newly created view, I clicked on the link “Use in New Report” in the Action column:

rss2

This brought me to the Report Create screen that you’re already familiar with from other posts.  Being that the view already contained the column names I wanted to see in my report, I simply clicked the Create Report button and went straight to the Export tab.

Step 3: Creating the RSS Export

I spent the most time on this screen trying to decide what to input into the free-form fields:

RSS Export Screen

Everything on the left-hand side of the screen describes the feed itself, while everything on the right-hand side of the screen describes the individual listings in the feed.  As such, everything on the left-hand side of the screen will need to be provided by you when you create the RSS export.  Don’t worry - if you don’t like what you’ve input into the fields you can always come back later and update them.

For the most part, you can see that the database view I created contained field names very similar to what they would map to in the RSS Item screen.  I did this on purpose to speed deployment - but you could name your columns anything you want to and simply map them to the RSS Item attributes as appropriate on this screen.

Step 4: Embedding in the Website

Once the RSS Export was created, I pointed my browser at the URL Bluyah provided by clicking on the “Get Link” link in the Action column:

RSS Get Link

As you can see, the results are a standard RSS feed:

     https://richard.bluyah.com/export/rss/89387b6026e5012c6ef9002241319b39

Rather than use the IFRAME embed code provided by Bluyah (above) I decided I wanted a simple RSS icon hyperlinked to the feed instead.  If you checkout the homepage of Pif Magazine you’ll see the feed icon at the top-left of the screen.  

Final Thoughts

To me, the speed at which this feature was deployed to Pif is absolutely amazing.  Rather than spend 2-3 days writing an RSS feed generator into the code base (including testing and deployment), I spent a little over 10 minutes creating the database view, another 2 connecting to that view through Bluyah, creating the report and RSS export, and finally another 2 minutes embedding the RSS image with hyperlink to the RSS feed into the side-nav of the website.  All total, it was less than 15 minutes from “soup to nuts”.  In terms of development costs, the magazine just saved itself roughly $500 - and turned around the feature far quicker.  What could be better?


Tweet This Share via Facebook Digg It! Add to Del.cio.us Add to Technorati Favorites Stumble It! Email this Print Friendly

Categories: Eating Our Own Dogfood Tags: ,

Creating a Presentation Export

May 15th, 2009 admin Comments

In this next screencast in the series, we present a overview on how to create a Presentation Export:


Tweet This Share via Facebook Digg It! Add to Del.cio.us Add to Technorati Favorites Stumble It! Email this Print Friendly

1.1.0 Release Notes

Version 1.1.0 will launch on Saturday, May 16th, 2009, during the 8:00 - 9:00 PM (PSD) maintenance window.

This release introduces a major new feature: Presentation exports.  More details, as well as a screencast, detailing how to use Presentations will be coming shortly.

Contents of the release are as follows:

  • Sharees are no longer allowed to disable a database view from being used by all users in the account when that connector is shared to them. [Ticket #205]
  • Sharers can now limit sharing to specific database views or Google Docs spreadsheets, without the need to share the connector itself.  In addition, connector sharing has been moved from the Connector Edit screen to the DB Views/ Google Spreadsheets Details page, in order to be more intuitive.  [Ticket #203]
  • Enhanced the Professional and Enterprise accounts so that all communications with Bluyah are over SSL for these account levels. [Ticket #40]
  • XML Connectors now allow optional username and password.  So if you wanted to connect to your Twitter account timelime, you could do so with Bluyah, then export that data into any export format you choose. [Ticket #224]
  • Fixed bug in Map Export that would prevent 1st item in pop-up bubble from being displayed if the element name contained a space. [Ticket #268]


Tweet This Share via Facebook Digg It! Add to Del.cio.us Add to Technorati Favorites Stumble It! Email this Print Friendly