Benutzeranmeldung

hoelterhof.net

Tobias Hölterhof

Drupal 5: Customize RSS-Feeds with Views

As far as I found out, drupal 5 does not provide an easy way to offer customized rss feeds. The Views RSS modules features a page view as rss feed, but the feed it generates does not include the fields of a view. The feed rather contains the title and a link to the corresponding note for every item. A first attempt to improve the rss page view is made here, but until now no module has been written to implement a new view style plugin. So I took the the code snippet and included it in a drupal 5 module with some improvements.

The new module View List RSS offers the following features:

  • A new and customizable rss page view for the Views module. The rss feed includes all fields defined in the view. The rss item tags are labeled like the label of the corresponding feed. The description-tag of an item can be merged by two or mode fields.
  • Change the default rss feed of the website to a customized feed provided by a rss page view.

To illustrate the rendering of the rss feed by my module from the views fields, I would like to give an example. If a View contains the following fields, the resulting rss feed is rendered like the xml code below.

The two fields labeled as "description" are merged together in the description-tag of the rss feed. The title-tag is created from the field labeled as "title". Finally, every feed item has an additional tag "dc:creator". The xml code of the generated feed looks like this:


<rss version="2.0" xml:base="http://www.test.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Demonstration</title>
 <link>http://www.test.com</link>
 <description>This is a demonstration</description>
 <language>en</language>
<item>
 <title>Title</title>
 <link>http://www.test.com/node/12</link>
 <description>03/09/2009 - 10:35<p>This is the body text of a node</p>
 </description>
 <dc:creator><a href="/user/2">hoelterhof</a></dc:creator>
</item>

The attached file contains the View List RSS module for Drupal 5. To install it just extract it and place the folder in your drupal module direcotry. Then enable the module on the system modules page. Now a new page type is available in Views.

AnhangGröße
drupal5-view_list_rss-v0.1.tgz2.23 KB

Kommentare

thanks for the work!

Inhalt abgleichen

(c) 2009 Tobias Hölterhof | CMS Drupal | Layout basiert auf Abac von Artinet