ReachRSS includes a powerful template engine that allows you to customize the look in almost any way you can imagine. This page is divided into several sections: Template Basics and Template Variables.

Template Basics

ReachRSS templates are normal HTML (you can build your templates in HTML editors like Dreamweaver if you like) with some added elements. <channel> and </channel> define the HTML to be repeated for every channel displayed, and <item> and </item> define the same area for items inside the <channel> tags. <item> MUST be contained inside <channel> in order to properly work.

Here's a simple example of what <channel> and <item> need to look like in your template file:

<title>ReachRSS - PHP Based RSS Reader</title>

{channel:title:linked} <item>
{item:title:linked} </item>

This will end up printing a channel title, followed by one or more items, followed by the second channel title, etc. If you have any experience with HTML you'll probably already see how the basics work.

You'll also notice in the example above some text surrounded in curly braces { and }. In ReachRSS templates, these are variables that will end up being replaced by the appropriate text when Reach parses the template to be displayed. A full list of template variables are in the second section below, for now know that {channel:title:linked} creates a channel title link (eg: "Wired News Headlines") and {item:title:linked} does the same for an item (eg: "Something Happened").

The interesting thing about variables in ReachRSS templates is you can include other text (and HTML) inside the curly braces, and that text (or HTML) will only appear if the value you've specified exists. This allows for some powerful formatting options.

For example, not all items have a description property (it's quite common in RSS feeds to simply send a title and link without a description). You want to display a description in a different font, on it's own line, however if there is no description, you don't want those font tags and line break to appear. To do this, place the <font> and <br> tags inside the curly braces, like so:

{<font size="-1">item:description</font><br>}

This way if there is a description for the item, the <font size="-1"> and </font><br> will be included. If there is none, the entire section inside the braces will disappear. There's no limit to the options you can do with this feature (you could even include whole sections / tables / layers only when certain elements appear).

Template Variables

There are template variables for most standard RSS elements, and they're broken up into two sections, channel and item. Channel variables can appear anywhere inside the <channel> and </channel> tags, including in the items themselves. Item variables can only appear inside the <item> and </item> tags.

If you can't get a variable to work, make sure you check that the raw RSS feed includes that tag/item - if it doesn't exist, or if it's empty, the variables will be empty too.

Global Variables
Global variables can be used anywhere in the template.

Places a "Powered by ReachRSS" 88x31 pixel icon on your page that links to RSS Powered By ReachRSSthe ReachRSS homepage (see example on the right). Unregistered versions of ReachRSS require this value somewhere in your template. Even if you register your copy of ReachRSS, we would appreciate a link back to us :-)
{admin:url} The URL that you can access the admin interface at. If you disable the admin interface by setting the admin password to "", this url (and anything else inside the { }) will not appear on the page.

Channel Variables
Channel variables can be used anywhere inside the <channel> and </channel> tags, even inside items.

The url of the RSS feed
An HTML code snippet with the channel's image (including width, height, alt and title tags if available)
Same as above, but surrounded by an HTML link (<a>) if available
The channel's image url (for use in image src="" attributes)
The channel's image link (url only, no HTML tags)
The channel's image title
The channel's image width
The channel's image height
The channel's title
The channel's link (url only, no HTML tags)
Creates a hypertext link using the channel's link and title. If no channel link is available, just prints the title
The channel's description
{channel:description:text} The channel's description converted to text only
{channel:description:200} The channel's description converted to text only and truncated to 200 characters (replace 200 with however many characters you want the description limited to)
{channel:webMaster} The email address of the channel owner
{channel:webMaster:linked} Creates a HTML link to the channel's owner. If the address provided is an email address, creates a "mailto" link. If it's an http address creates an http link.

Item Variables
Item variables can only be used inside the <item> and </item> tags.

The item's title
{item:title:linked} Creates an HTML link to the item using the item link and title
{item:link} The item's link (url only)
{item:permaLink} If the item provides a permaLink address, this creates a standard purple pound sign (#) linked to the permaLink address
{item:category} The item's category
{item:description} The item's description
{item:description:text} A text only version of the item's description
{item:description:200} A text only version of the description limited to X characters (eg 200)
{item:pubDate} The original (unaltered) pubDate from the item (or dc:date if pubDate isn't available). Note this string is not adjusted to your own time zone.
{item:timeSince} How long ago the item was published (eg: 5 hours and 4 minutes). This is the recommended method of publishing times since it's readable by people in any timezone (and is more 'natural' that displaying a date / time). The possible combinations are "minutes seconds", "hours minutes" and "days hours".
{item:date(dateFormat)} Uses the PHP "date" function to format the date according to "dateFormat". The result will be the date/time the item was published adjusted for your server's timezone


Home | Features | Samples | Demo | Download | Register | Help / Support