Kentico CMS 6.0 Developer's Guide

RSS feed + Data source

RSS feed + Data source

Previous topic Next topic Mail us feedback on this topic!  

RSS feed + Data source

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

By connecting the RSS feed web part to a data source, you can create an RSS feed of the data provided by the data source. The Atom feed web part can be used exactly the same way, but the rendered feed is in the Atom format.

 

In the previous example, we have demonstrated how to use the CMS RSS Feed web part to create an RSS feed of documents stored in the content tree. The approach that we will explain now can also be used for that purpose, but you will typically use it to create feeds from Kentico CMS objects (forum posts, board comments, media files, ...).

 

In the following example, you will see how to create an RSS feed of forum posts in the site forums on the sample Corporate site. We will achieve this using the RSS feed and Forum posts data source web parts. The same procedure can be used for any other data, you only need to use a properly configured data source and handle the provided data by a suitable transformation.

 

 

 

Please note

 

The result of the following example can also be achievable using a single web part - the Forum posts RSS feed web part, which has a built-in Forum posts data source. Similarly, there are all-in-one web parts for other frequently used document types and objects (see the listing here).

 

The following example uses two separate web parts for educational purposes only.

 

 

1. Sign in to CMS Desk and select the /Forums page from the content tree. Switch to the Design tab and click the Add web part (AddWebPart) icon of the zoneLeft web part zone.

 

devguide_clip1006

 

2. Select the Data sources/Forum posts data source web part and click OK. Leave all its properties at the default values, which will result in the data source providing all forum posts from all forum groups on the site. Click OK. The data source will be added to the bottom of zoneLeft.

 

3. Click the Add web part (AddWebPart) icon again and select the Syndication/RSS feed web part. Click OK and enter the following in the Web part properties dialog:

 

Link text: Forum posts RSS feed

Feed name: MyForumPostsFeed

Feed title: Corporate Site Forum Posts

Feed description: This is a sample feed of all forum posts on the Corporate Site.

Data source name: ForumPostsDataSource

Transformation name: CMS.RSSTransformations.ForumPosts

 

Leave defaults for the rest of the properties and click OK. The two web parts should now be at the bottom of the web part zone and fully configured for the required behavior.

 

devguide_clip1008

 

4. Sign out of CMS Desk and browse to the Forums page. You should see the RSS icon and link as highlighted in the screenshot below.

 

devguide_clip1007

 

5. Click the icon or link, your browser will detect that you are accessing an RSS feed and display its content. As you can see, the URL of the feed is actually the URL of the page where the web part is placed with the ?rss=MyForumPostsFeed querystring appended (this can be modified using the Feed querystring key and Feed name web part properties). The same URL can be used to access the feed directly both from a browser or a dedicated RSS reader program.

 

devguide_clip1009