Account: [ Log in/Create Account ]

Create or Edit a Template »

You can use this form to create or edit templates. These templates are what is applied to your data feeds when you trigger a publish action.

Template Title
?

Template Description
?

Template Details
?

Template Details Explained »

Templates are what gets applied to your feeds when you trigger a publish action.


Template Sections »

You can break templates up into logical sections by defining the sections with special tags that look like the following:

[ === SECTION 1 === ]

Sections headers, like the one above, will not render in your actual feed and are only used internally by the fubnub bots. You can use any value you like to reference a section header so long as you use the format of [ === XYZ === ] (where XYZ is whatever value you want to use).

The one exception is [ === BODY === ] which is what fubnub uses internally to know what section to apply to each item in your feed. This means that if you do define sections, you must make sure to define a [ === BODY === ] section that you want to apply to your each item in your feed (otherwise you'll just get your basic template back without any data from your feed injected into it).

If you do not define any sections in your template, the entire template is considered to be one logical section (ie. the [ === BODY === ] section) and will be applied to each of your feed items.


Template Fields »

Within a template, you use a special place holder to reference the details from your feed. The syntax for this holder is:

[' user ']

The value you use within your place holder should relate to the tag name from your feed.

For example, the last.fm recent track XML has a <name> tag, so if I want to use that name value in my template, I would define the place holder (in my [ === BODY === ] section) as [' name '].

 

A Quick Example of the Process »


1. If you have a raw feed something like this »

<?xml version="1.0" encoding="UTF-8"?>
<recenttracks user="RJ">
  <track streamable="true">
    <artist mbid="b7ffd2af-418f-4be2-bdd1-22f8b48613da">Nine Inch Nails</artist>
    <name>The Great Below</name>
    <mbid></mbid>
    <album mbid="">The Fragile</album>
    <url>http://www.last.fm/music/Nine+Inch+Nails/_/The+Great+Below</url>
    <date uts="1211226740">19 May 2008, 19:52</date>
  </track>
  <track streamable="true">
    <artist mbid="b7ffd2af-418f-4be2-bdd1-22f8b48613da">Nine Inch Nails</artist>
    <name>The Frail</name>
    <mbid></mbid>
    <album mbid="">The Fragile</album>
    <url>http://www.last.fm/music/Nine+Inch+Nails/_/The+Frail</url>
    <date uts="1211226638">19 May 2008, 19:50</date>
  </track>
  <track streamable="true">
    <artist mbid="b7ffd2af-418f-4be2-bdd1-22f8b48613da">Nine Inch Nails</artist>
    <name>The Day the World Went Away</name>
    <mbid></mbid>
    <album mbid="">The Fragile</album>
    <url>http://www.last.fm/music/Nine+Inch+Nails/_/The+Day+the+World+Went+Away</url>
    <date uts="1211226249">19 May 2008, 19:44</date>
  </track>
</recenttracks>

2. And you associate it to a template like this »

This is a simple template with a header and footer section showing off how applying a template really works for my last.fm recent tracks.

<h1>I just listend to</h1>
[ === body === ]
<li>[' name '] by [' artist '] from the [' album '] album.</li>

[ === footer === ]

Don't you think this is some cool stuff to show off?

3. When you publish it should look like this »

This is a simple template with a header and footer section showing off how applying a template really works for my last.fm recent tracks.


<h1>I just listend to</h1>

<li>The Great Below by Nine Inch Nails from the The Fragile album.</li>

<li>The Frail by Nine Inch Nails from the The Fragile album.</li>

<li>The Day the World Went Away by Nine Inch Nails from the The Fragile album.</li>


Don't you think this is some cool stuff to show off?


Other Stuff: [ About ] [ Blog ] [ F.A.Q. ] [ Technology ]