The RSSBus Admin Console makes it easy to browse through connectors, try available operations, and create feeds using operations. It has a wizard that walks you through the process of creating and publishing a feed from an operation in just a few clicks. While the wizard helps you create a basic feed, it doesn't come close to harnessing the capabilities of RSBScript. Using RSBScript you can customize and change every aspect of the feed declaratively. In this article, will discuss a few popular customizations.
Changing the title and description of the feed:
The title and description of a feed are derived from the title and description defined in the operation's metadata and can be easily modified in script. For example, the following snippet would change the title and description in the channel of the feed.
<rsb:info title="Customer List" desc="List of new customers">
Adding other attributes to the channel:
The channel of a feed is represented by the _meta item. To add an attribute to the channel, simply add the attribute to _meta item of the feed. For this to be effective, you need to add the attribute to _meta before the first item is pushed.
<rsb:set attr="_meta.rss:webmaster" value="me@my.com"/>
<rsb:call op="fileListDir">
<rsb:push/>
</rsb:call>
Changing the title and description of the feed items:
The title and description of each item in a feed can be modified by using the <rsb:push> keyword. The title can be modified by changing the title parameter of the push keyword, and the description can be modified by changing its contents. Note that you can freely use template substitution to compose the description of each item.
<rsb:push title="[message]">
[paypal:payername] made a purchase for the amount of [paypal:netamount]
Content produced by <a href="http://www.nsoftware.com">RSSBus</a>.
</rsb:push>
Removing an attribute from the feed items:
Normally, a feed generated by the Feed Creation Wizard will push all the attributes produced by the underlying operation to the output stream. To remove attributes from the feed simply unset them. For example, the following snippet removes the file:mtime and file:atime from a file listing.
<rsb:call op="fileListDir">
<rsb:unset attr="_.file:mtime"/>
<rsb:unset attr="_.file:atime"/>
<rsb:push/>
</rsb:call>
Adding an attribute to the feed items:
To add an attribute to all the items of a feed simply add it to the item being worked on. For example, the following snippet adds an author attribute to each item.
<rsb:call op="sqliteQuery">
<rsb:set attr="_.author" value="me@my.com"/>
<rsb:push/>
</rsb:call>
Pushing items that satisfy a certain criterion:
To filter items produced by an operation you can use any of the conditional keywords (rsb:select, rsb:check, rsb:equals etc.) in RSBScript. For example, the following snippet will create a feed containing just the directories and no files.
<rsb:call op="fileListDir">
<rsb:equals attr="file:isdir" value="true">
<rsb:push />
</rsb:equals>
</rsb:call>
While we have shown some of the more common customizations, there is more that can be done using RSBScript. Please look at the Scripting section of the user's guide for more details.