TemplateEngine

 Edit this page
This page describes our goals for templates; in the current implementation this is the TinyTemplateEngine.

A template is an XML document that provides the user interface for an object in Wheat. The template contains no executable code - all computation is in Wheat objects.

We expect that templates will be created in WYSIWYG editors (such as Dreamweaver or GoLive). With modern layout and graphic complexity, these are really the only rational way to create great looking web sites. Hence, templates must be conforming XHTML documents at all times.

There are several aspects of templates to be designed:

Markup

Parts of the template must be identified so the renderer can identify and manipulate them. The constraints are that the document must still be valid XHTML, and that the identification doesn't interfere with whatever WYSIWYG editor the user is using.

A likely approach is to use attributes in a special template namespace. This way it should be completely ignored by the editors, and any browsers being used to preview the templates while being created. A good example of this approach is TAL from Zope's Page Templates. (See references at bottom).

Another thing to keep in mind is that we want templates to represent modules that could be nested and combined into pages. Hence, Wheat's templates don't represent whole pages. However, the template itself must be valid, whole XHTML page (or the WYSIWYG editor and browser previewing won't work). So the template needs a way to indicate where the actual template starts in the XHTML.

A common problem with the markup of most template systems is that there is no way to put in sample data for viewing during template editing that is then ignored during generation. The template system needs a way to mark elements as only being there for design.

Rendering


Mixing, Nesting & Combining



Discussion

Well, you have the right idea about what a templating system should look like. At work we've been hunting around for one and haven't found any well-developed realizations of the concept. XMLC and the templating system which is part of http://calliope.sourceforge.net/ seem to be the ones floating around, but neither one seems particularly mature.
--JimKingdon 2003-03-07

Q Where do CSS style sheets fit into all of this? Are there CSS fragments that go with template fragments all of which get assembled into some site CSS?
It looks like most (all) agree that content should be separated from presentation, and that CSS should be used for presentation. Thus, CSS fratments might need to be associated with template fragments, with appropriate tools to combine into site CSS & warn of conflicts. --TimLearmont 2003-03-08

In the W3C markup model you always need CSS for XHTML: XHTML is structure only and all formatting is supposed to end up in the CSS. --MarkLentczner seconded --JimKingdon

It doesn't look like XSLT will have much/any role in wheat.


References:
There is no comment on this page. [Display comments/form]