<xmod:Feed>

The Feed tag, first introduced in version 3.0, is used to define the output of feeds. A feed typically is thought of as an RSS feed, but it can be much more than that. With the Feed tag, you can produce virtually any XML-based output, a printer-friendly HTML page, a plain text page, even a comma-delimited file that can be automatically opened by Excel or a similar program.

Creating A Feed

Creating a feed is a two-step process:

  1. Create your feed on the Manage Feeds page in the Control Panel. The Feed is very similar to XMod Pro's Template tag and is created in a similar fashion. You begin by clicking the "New Feed" button. On the dialog which pops-up, choose the type of feed you want to create, select a data source, and click the dialog's "New Feed" button to create it. From there, you can edit your feed in the editor.

    The Feed Tag is defined much the same way as the Template tag. You define your data source in the ListDataSource tag. You use the Header, ItemTemplate, AlternatingItemTemplate, and Footer tags to format the display of your data.

    Helpful Formatting Tip: If you are creating a CSV (comma-separated values) file or a file with similar plain text formatting, you will probably need to pay attention to the spacing of the tags in your feed. Unlike HTML, extra whitespace and linefeeds will show up in a plain text file.

  2. Call your feed. You can get an example of how to call your feed by clicking the "How To Call Your Feed" link on the Manage Feeds page. Basically, you link to it like you would any other page. You'll call XMod Pro's "Feed.aspx" page and pass it a few required parameters and any additional parameters your data source may need to retrieve the data.

    Use a URL in the form of:
    http://sitename/DesktopModules/XModPro/Feed.aspx?xfd=FeedName&pid=PortalId

    Where sitename is your site's domain, FeedName is the name of the feed as listed in the grid, and PortalId is the numeric ID of the portal for which the feed is created.

A Note About Security

It's important to note that feeds, by their nature, are typically intended to be public. No special security measures have been implemented for securing the feed. So you should be careful about what data you make available through a feed. One way you could make your feed more secure is by creating and passing a token to the feed. This token would then be checked by your data source (most likely a stored procedure) to determine its validity, returning the data only if it's valid.

     

Syntax

<xmod:feed
    Doctype="string"
    ContentType="string"
    ConnectionString="string"
    Filename="string"
    ViewRoles="role1,role2,role3">

    <ListDataSource CommandText="string"
        ConnectionString="string"/>

 

    <HeaderTemplate>...</HeaderTemplate>
    <ItemTemplate>...</ItemTemplate>
    <AlternatingItemTemplate>...</AlternatingItemTemplate>
    <SeparatorTemplate>...</SeparatorTemplate>

    <FooterTemplate>...</FooterTemplate>

</xmod:feed>

Remarks

Back to top

Example

<xmod:Feed ContentType="application/vnd.ms-excel" Filename="test.csv">
<ListDataSource CommandText="SELECT [AuthorId], [FirstName], [LastName], [GenreId] FROM Authors"/>
<HeaderTemplate>Author Id,First Name,Last Name,Genre Id</HeaderTemplate>
<ItemTemplate>[[AuthorId]],[[FirstName]],[[LastName]],[[GenreId]]</ItemTemplate>
</xmod:Feed>
Back to top