The Morfik RSS package contains a single widget (Rss) that can be used to quickly create an RSS syndication feed for a website.
A Quick Walkthrough
To use the Morfik RSS package simply add the package to the project by utilizing the “Used Packages” command on the project ribbon (see Figure 1 Used Packages Command), or simply drag the package file onto the application main client area. Once added a single widget will appear on the home ribbon when the form designer is active (see Figure 2 Widgets List). This widget can be placed on application forms and provide immediate functionality with minimal coding.
|Figure 1: Used Packages Command|
|Figure 2: Widgets List|
A Quick Walkthrough – Sample
The best way to understand how to use the RSS widget is to create a sample application. To get started, open a new Morifk 3 application and add the Morfik RSS package as outlined above.
Before starting with the details of the sample application, let’s see what will be needed to use the RSS widget. After the widget is dropped on a form, there is one property that will need to be set in the Property Inspector and that is the Feed property, which we will set to TheFeed. Then, we will click on the more options arrow of the widget and select the Settings option, as seen in Figure 3 Choosing the Settings Options.
|Figure 3: Choosing the Settings Option|
Once the settings dialog appears we will click on the New button to add a new Feed Source. This will display the dialog box seen in Figure 4 Configuring the Feed Source.
|Figure 4: Configuring the Feed Source|
In the Feed Details section, the Name field will match the Feed property set in the last step (TheFeed). Notice as part of the Feed Details we will need to specify a Data Source for the Feed. The section below the Feed Details, the Feed Items, is where fields from the Data Source will be matched to the standard RSS feed fields. For the Hyperlink field we will need to select a published link to a page that will be used to display the full feed information. The Additional Info section will be discussed later.
A Quick Walkthrough – Create the Table
Let’s create a table called News with the following fields:
|Picture||Picture||Embedded (URL Root = pics)|
|Thumbnail||Picture||Embedded (URL Root = pics)|
The Thumbnail picture field will hold a smaller version of the Picture picture field (It’s always nice to have pictures). Now add some data to the table so there will be something to publish. Create a query (qryAllNews) that includes all the fields in the News table above and also create a second query (qryOneItem) that includes all fields above but also includes a criteria parameter of NewsId for the Id field.
On the Index page of the application, create a subform that holds a continuous form which has the Data Source set to qryAllNews. Drop an image and some textlabels on the subform so that it looks something like the form in Figure 5 All the News That’s Fit to Print. (The image is tied to the Thumbnail field.)
|Figure 5: All the News That’s Fit to Print|
Publish this page as Index and created another page with a subform holding a single form with a Data Source of qryOneItem. This new form should then have a parameter NewsId in the list of parameters. Add the fields for the query and you should have something looking like Figure 6 One News Item. (The image in this form is bound to the Picture field.)
|Figure 6: One News Item|
Now publish this page as pageOneItem with a parameter of NewsId (the published page should look like pageOneItem/[NewsId].
Return to the Index page and set the Hyperlink property of the Image and the Title label to pageOneItem?NewsId=[$id].
A Quick Walkthrough – Add the RSS widget
To create the RSS feed, drop an Rss widget on the header of the Index form and set the Name to TheFeed as discussed previously. Refer to the start of this walkthrough and bring up the Settings dialog and add a new Feed Source with the Name of TheFeed and fill in the fields as follows:
Title and Description - whatever you want DateSource – qryAllNews
Title – title Description – description Author – author Publish Date – publishDate Max Feed Size – whatever you want (20 is a good number) Hyperlink - pageOneItem?NewsId=[$id]
Language – codes can be found at http://www.rssboard.org/rss-language-codes (example: “en”:English) Generator – you application name (usually) Copyright – this year, use Copyright 2010 Categories – whatever you think is appropriate for your feed Feed Kind – you can select RSS 2.0 or Atom 1.0 The rest are up to you.
Compile and run and check it out.
For more information on RSS feeds, a good source (in English) can be found here.