[ZDP] BackTalk to Document The Zope Book (2.6 Edition)/Using Zope
Page Templates
webmaster at zope.org
webmaster at zope.org
Fri Mar 26 19:58:58 EST 2004
A comment to the paragraph below was recently added via http://zope.org/Documentation/Books/ZopeBook/2_6Edition/ZPT.stx#1-6
---------------
A Page Template is like a model of the pages that it will generate.
In particular, it is a valid HTML page.
% Anonymous User - Mar. 25, 2004 3:28 pm:
Zope Page Templates generate validation errors (for example at http://validator.w3.org) because of invalid
attributes, even when attribute namespaces are declared. How then is a Zope Page Template valid HTML?
% Anonymous User - Mar. 26, 2004 7:58 pm:
It's true that PageTemplates resemble HTML, but they also include TAL, METAL, and TALES statements which are
only useful to Zope, not web browsers. Remember that PageTemplates are *not* HTML documents, they are
instructions for Zope that detail how to build HTML documents out of dynamic data.
You can only validate the HTML in documents that have been rendered from a PageTemplate, you cannot directly
validate the PageTemplate itself. But the template has to contain valid HTMl, otherwise when it is rendered
the resulting HTML document won't be valid.
It not surprising that PageTemplates won't validate, using an HTML validator. They are often incomplete HTML
documents, lacking the neccessary <html>, <head>, and <body> elements for example. When Zope renders a page
from a template, it usually draws upon many other dependent templates.
PageTemplates resemble HTML well enough to be rendered by most browsers and visual editors. They are intended
to make life easier for HTML designers because they can build HTML pages using dummy content, then the
programmer adds the instructions that replace the dummy with dynamically acquired data. The page design is
separated, from the logic design, yet both can be easily maintained.
To understand the philosophy behind Page Templates, see them in action in this <a
href="http://zope.org/Documentation/Articles/ZPT3">tuttorial</a>.
More information about the ZDP
mailing list