About Sitellite       Screenshots       Downloads       Forge      Documentation       Community       Support

You are here: Home / Documentation / How To: Templates in Sitellite

How To: Templates in Sitellite

Introduction

Sitellite's template system is a little more sophisticated than most, which can cause some initial confusion for those just starting out with it.  However, since all of the aspects of Sitellite's template system were designed so that you could do the most with it with the least amount of effort (including thinking :)), a good introductory article is in order to help you get going faster, and to help you avoid unnecessary pitfalls.

Sitellite's template system begins the same way most do, with a template language.  Where we decided to veer off the well-trodden path of others is in the fact that Sitellite actually has two template languages, with two different purposes.  We did this because we recognize that different languages could provide more benefits to their different target users (designers and developers) than a one-size-fits-all solution.

First there's XT, which stands for eXtensible Templates.  XT is an XML-based template language which has its origins in the Zope application server, the Cold Fusion programming language, and a few other technologies as well.  The idea behind XT is that designers need a template language that works with their existing tools, and especially with ordinary web browsers, outside of the Sitellite environment.

The solution, as originally conceived by the Zope project, is that browsers and editors handle XML tags and attributes that they do not recognize in a very conveniently exploitable way: They ignore them.  So an XT template, while being a mixture of HTML and XML tags, can be viewed in Internet Explorer or any other web browser without the need for Sitellite to pre-process it, making XT templates previewable while designers do their work.  Obviously being able to see what you're doing is key to being able to do your job, and we all know that the less time you spend fighting with technology the more time you can focus on being creative.

XT actually takes the idea of previewability to a whole new level though, by allowing fake content to be inserted into templates that is automatically replaced with real content when they're inserted into Sitellite.  This is important to being able to make changes and see how they will actual affect your content.

Of course, as you're probably thinking, XML isn't the easiest thing for designers to use.  However, neither is PHP, or any other custom-made template solution ({$tags[tag].keyword} anyone?).  However, the ease-of-use differentiator in any technology is not how simple it is (read: limited), but how good the documentation and support is.  So for any given solution, your mileage may vary.

The second template language in Sitellite is called SimpleTemplate.  This name seems in sharp contrast to the last paragraph (and probably is), but if you give me a minute, I can explain. :)

SimpleTemplate is a programmer's template language: Quick to write, quick to run, terse but highly legible, and powerful.  SimpleTemplate has all the usual template necessities (substitutions, loops, conditions, includes, etc.), but is very syntactically slim.  What you can do in 5 lines of PHP code, and 5 lines of template code, you can often do in 1 line of PHP code, and 2 lines in SimpleTemplate, while also improving the legibility of the developer's intent.  This is a critical aspect of writing reusable code, and of collaborating between multiple developers.

The purpose of SimpleTemplate is in formatting the results of a box or action before sending it to the global XT template to be packaged and shipped.  As such, previewability outside of Sitellite becomes unnecessary, and so XT's benefits would actually become detractors.  Starting to see the bigger picture yet?

Next up: Directory Layout

Page 1: Introduction
Page 2: Directory Layout
Page 3: Naming Scheme
Page 4: Custom Template Sets

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.