RSS Module

Content

Module Overview

Overview

This module adds RSS syndication capabilities to OpenCms. The module includes:

  • RSS content type (support for RSS 1.0, 2.0 and Atom 1.0)
  • RSS template element (support for RSS 1.0, 2.0 and Atom 1.0)
  • Generation of RSS 1.0 from any content folder within OpenCms

Support

This module has been tested in OpenCms 6.0.4, 6.2 beta, 7.0.3.

License

This module is available under GNU GPL license.

Source Code

Source code for this module can be downloaded here. If you decide to make any changes to the source code, we would appreciate your contribution back to the module by informing us at solutions@clicksandlinks.com.

Release History

06.12.2007 - Version 0.8 Ported to version 7. New version can be downloaded from here.

11.06.2007 - Version 0.7 Fixed a problem with encoding the incoming data. Incoming stream now uses OpenCms default character encoding.

Installation

Overview

This document describes the required installation steps for the OpenCms RSS module.

Download Module

The module and required libraries can be download from the links below:

Install Required Libraries

OpenCms includes currently version 2.0.2 for Jakarta Commons HttpClient library. The RSS module uses some of the features from HttpClient version 3 and therefore the default HttpClient library shipped with OpenCms must be replaced. The library can be replaced by removing the old library from the OpenCms web application lib directory and then uploading the library supplied with the RSS module.

Install OpenCms Module

Install the RSS module by uploading the zip file provided into OpenCms using the module management interface (Import Module with HTTP option). Restart Tomcat, so the HttpClient library will get replaced in memory.

Localisation

RSS module has full localisation support the same way than all other aspects of OpenCms. New localisation can be created just simply by creating a localised copy of /system/modules/com.clicksandlinks.opencms.rss
/classes/com/clicksandlinks/opencms
/rss/workplace.properties (e.g. workplace_fi.properties for a Finnish locale).

 

Usage

Overview

This document describes the RSS module usage.

RSS Content Type

The module adds a new structured content type called RSS Page. New RSS Pages can be added to the OpenCms workplace exactly the same way than any other structured content as follows:

  1. select New --> Structured Content --> RSS Page.
  2. Add the page title and properties and saving the page.
  3. Do left client on top of the resource type icon in order to see the OpenCms editor options and select Edit.
  4. Populate the feed content accordingly. The meaning for all content fields is described below:

Name - This is the feed name and will be used as a page title.
Description - This is a short description for the feed and will be displayed as part of the metadata.
Feed Location - This is the feed source location.
Number of Items - Number of feed items to be displayed.
Titles Only - This box can be checked if you would like to display the feed in more compact format and hide the titles.
Introduction - Introduction text for the feed. This text will be displayed on the page before the actual feed.
Start Date - Standard OpenCms content live date.
Expiry Date - Standard OpenCms content expiry date.

In order to display your feed content as part of your templates you must include element /system/modules/com.clicksandlinks.opencms.rss
/pages/rsspage.jsp as part of your templates.

TIP: A quick way to see if the above has worked before you have modified your templates is to set page property ' template-elements' to /system/modules/com.clicksandlinks.opencms.rss
/pages/rsspage.jsp and preview the page. This property replaces the template with the selected template element.

RSS Template Element

The module can also be used to include feeds as part of your OpenCms templates by calling JSP /system/modules/com.clicksandlinks.opencms.rss/
elements/import_feed.jsp using the cms include tablig. Please see an example call below:

<cms:include  page= "/system/modules/com.clicksandlinks.opencms.rss 
/elements/import_feed.jsp">
    <cms:param name="feedURL">http://www.bbc.co.uk/doctorwho/
news/syndication/rss091.xml</cms:param>
    <cms:param name="divId">element_rssfeed</cms:param>
    <cms:param name="feedNumber">10</cms:param>
    <cms:param name="titlesOnly">false</cms:param>
    <cms:param name="cacheTimeout">60</cms:param>
</cms:include>

where the fields are:

feedURL - The feed source location.
divId - Div id surrounding the feed element. This can be used for styling purposes.
feedNumber - Number of feed items to be displayed.
titlesOnly - This box can be checked if you would like to display the feed in more compact format and hide the titles (allowed values are true and false).
cacheTimeout - All feeds are cached within the servlet context. This parameter allows you to set the cache timeout in minutes.

Generation of RSS from Content Folder

Content list of any OpenCms folder can be made available in RSS 1.0 format using the /system/modules/com.clicksandlinks.opencms.rss
/interfaces/generate_rss.jsp. The Folder URI is the folder location within the OpenCms VFS starting from the site root e.g. the Folder URI for /sites/default/demopages/ would be just simply /demopages/.

In addition it is possible to filter the feed for a single content type e.g. events by setting optional type parameter.

RSS Button

/system/modules/com.clicksandlinks.opencms.rss/elements/ folder includes rssbutton.jsp, which can be included as part of your custom templates in order to include simple rss button as part of your website. Example on way to style the RSS button can be found from folder /system/modules/com.clicksandlinks.opencms.rss/css/.

 

Troubleshoot

I get null pointer exception when trying to add a new RSS page after module installation?

RSS module content type uses content type id 51. Please make sure that your system does not already include a content type with this id, if it does modify line:

<type class="org.opencms.file.types.CmsResourceTypeXmlContent" name="rsspage" id="51">
      <param name= "schema">/system/modules/com.clicksandlinks
.opencms.rss/schema/rsspage.xsd</param>
</type>

in opencms-modules.xml accordingly.

/WEB-INF/jsp/offline/system/modules/
com.clicksandlinks.opencms.survey/
pages/survey_empty.jsp(4,0) According to TLD or attribute directive in tag file, attribute test does not accept any expressions

The default view utilizes <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> for testing some conditions. It looks like your Tomcat / OpenCms installation has some kind of problem with the use of this taglib.

Anyway, I would like to highlight that the way we build templates in OpenCms does differ a little from the traditional way to develop templates. Therefore you might want to create your own view for the survey content type and configure properties:

<property> <name>template-elements</name> <value type="shared"><![CDATA[/system/modules/com.clicksandlinks
.opencms.survey/pages/survey_empty.jsp]]></value> </property>

and

<property> <name>template-elements</name> <value type="shared"><![CDATA[/system/modules/com.clicksandlinks
.opencms.survey/pages/survey_result_empty.jsp]]></value> </property>

The above does not mean that you must write the views from scratch, but you can use views:

  • /system/modules/com.clicksandlinks.opencms.survey/
    pages/detail_survey.jsp
  • /system/modules/com.clicksandlinks.opencms.survey/
    pages/detail_survey_result.jsp

As samples and just add the header and footer includes like traditional OpenCms content types normally have.

The Content Grid is brought to you by Second Places.

Site Accessibility

  • Level Triple-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0
  • Valid XHTML 1.0!
  • Valid CSS!