Templates and RTML

Turbify templates are written in a programming language called RTML. So, if you want to edit or write your own templates, you need to learn RTML!

RTML is neither a server-side (such as ASP) nor a client-side technology (such as JavaScript). It's probably easiest to think of RTML as a custom design language that only works for Turbify. RTML uses the values and properties of your store as its input, does various manipulations, and outputs pure HTML. The advantage for you the user is that you don't have to know HTML or how to connect to databases and retrieve product information; you can build a fully functioning store by only entering the necessary information about your products and services by filling out easy-to-use forms. Turbify provides you with a set of templates that will take your simple input and create the necessary HTML.

Item pages and other pages such as info or privacypolicy use different types (when you edit these different pages, you see different input fields.) In editor version 2.0, different type pages use different templates. For instance, item and section pages use the page. template, the site map page (ind.html) uses the index. template, etc. In editor version 3.0, this has been simplified, so every page in your store uses one template, storetemplate., and that template figures out how to generate the HTML page based on what type of page we are talking about.

You can only program in RTML and work on templates live/online in the Yahoo! Store environment, using the template editor. So, no offline editor such as notepad can be used to create your code. (Well, this is not 100% true... There is a third-party software called the RTML Template Transfer Utility. That utility can download templates and store them in a text file - although in a somewhat proprietary format. Those templates can then be uploaded into any other Turbify.)

Just like HTML, RTML templates are evaluated from top to bottom. So, you have to build your template in the same logical order as you would in HTML.

Unlike HTML, RTML allows you to use logical programming expressions, such as variables, subroutines, conditional statements (IF…THEN), or iterations (FOR EACH….). Because of this, RTML is in fact a programming language.

Why is this useful? Well, it means that a single RTML template can output different HTML depending on the local properties and global variables. For instance, if you were to change the property of Page-format from Top-Buttons to Side-Buttons in the Variables form, the template will automatically produce the necessary HTML to display the buttons on the side of your page.

Take the following very simple template, for example:

  TITLE @name
  TEXT "Hello, my name is "
  TEXT @name

If you edit any page and change the template name to test, the page would write a personalized message on the page, "Hello, my name is ..." where ... would be replaced with whatever the page had in the name field.

There are about 80 to 90 RTML expressions, some of which have direct HTML equivalents. Other expressions perform string and image manipulations, iterations, or logical evaluations such IF or WHEN.

Templates can call other templates; this makes it possible to re-use common elements - such as navigation buttons - in different templates.

How do you invoke or "run" templates? Well, the only way to execute a template is by referring to it from within a page, and hit update. What you then see is an HTML page generated by the underlying template. So, once you publish your site the templates are "out of work" – they have generated the final static HTML pages that will be visible to the outside world.

While you can gain complete control over the design of your store with RTML, the fact that it is neither a client-side or server-side technology means that there are some things you cannot do with RTML, such as client-side validation or pulling dynamic data from a database. Also beyond your control are the checkout pages, the search result page, or shipping and tax calculations.