About Sitellite       Screenshots       Downloads       Forge      Documentation       Community       Support

You are here: Home / Documentation / How To: XT Template Essentials

How To: XT Template Essentials

Substitutions (Part 2)

Now let's look at a few more ways of writing XT tags that will be substituted for data.  Add the following to your template:

<xt:tpl>
    <a href="${site/url}">Phone home</a>
</xt:tpl>

When rendered in Sitellite, you will see a link that points to your web site.  When previewed outside of it, of course, you will see a link pointing to the literal string "${site/url}".

The ${} syntax allows you to specify paths inside attributes of any ordinary tag.  An alternate way of specifying the same thing as the link above, without compromising previewability of the link, is as follows:

<xt:tpl>
    <a
        href="http://www.yourWebSite.com/"
        xt:attributes="href site/url"
    >Phone home</a>
</xt:tpl>

The xt:attributes attribute essentially allows you to assign tag values to attribute names.  Nothing fancy.

A variation on the xt:replace attribute we saw above is the xt:content attribute, which only replaces the contents of the tag, not the whole tag itself, with the specified data.  For example:

<xt:tpl>
    <a
        href="${site/url}"
        xt:content="site/url"
    >http://www.yourWebSite.com/</a>
</xt:tpl>

This is handy in conjunction with conditions, as we'll see in the next part.

Next Up: Conditions

Page 1: Introduction
Page 2: First Steps
Page 3: Substitutions (Part 2)
Page 4: Conditions
Page 5: Loops
Page 6: Includes
Page 7: Boxes
Page 8: I18n
Page 9: XT Object Reference

All Tutorials

Members

Note: You can use your SitelliteForge.com account here and vice versa.

Username

Password

Forgot your password?

Not a member? Click here to register

Sitellite 5 Beta


Copyright © 2008, SIMIAN systems Inc.
All rights reserved. Privacy policy
Some of the icons on this site were created by the Gnome Project.