Tag Archives: jQuery

Client-side Rendering of RSS Feeds in Drupal

So I wanted to display the RSS feed of my latest Blog posts in the sidebar of my main website, which is powered by Drupal. Normally this would be trivial, if my Blog was also hosted by the same Drupal site. However, my Blog actually lives on a separate WordPress site running on the same web server. I wanted to learn both Drupal and WordPress, which is why I elected to have two separate CMSs (yes I realise this is just making life harder, but this is how we learn!).

Initially I installed the standard Feeds module, but for some reason it couldn’t aggregate the RSS feed from my Blog site. I eventually tracked the problem down to my web host Heart Internet. It seems they block loopback connections, which is preventing the underlying fsockopen() PHP call that powers the Drupal Feeds module from reading my Blog’s RSS file on the same server. Since all Drupal RSS modules use the same server-side socket connection model to read the RSS feeds, my only option was to use a client-side RSS aggregator.

After some research, I came across the PaRSS module, which uses the PaRSS jQuery plugin to actually do the work on the client. The installation is slightly complicated by the fact the jQuery plugins site is currently inaccessible due to development work, but you can download the necessary PaRSS files here. Once you’ve installed the module and library files, it’s quite easy to create a link (using the Link module) to represent the RSS feed URL, and then plug that in to a Drupal block with the formatter set to ‘PaRSS’ to ensure you get a nice jQuery-powered rendering of the RSS feed.

You can see my results in the left-hand sidebar of my main website, where it says “My Latest Blog Posts”. That is being populated on every page load by the PaRSS client-side library. This is not as elegant a solution as the Feeds module, but it offloads the effort from the Drupal server, and overcomes the restrictions of my web host. Sometimes you just gotta do what you gotta do.