[ZDP] BackTalk to Document The Zope Book (2.6 Edition)/Appendix C: Zope Page Templates Reference

webmaster at zope.org webmaster at zope.org
Fri Oct 14 23:42:42 EDT 2005

A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/AppendixC.stx#1-0


  Zope Page Templates are an HTML/XML generation tool. This appendix
  is a reference to Zope Page Templates standards: Tag Attribute
  Language (TAL), TAL Expression Syntax (TALES), and Macro Expansion
  TAL (METAL).  It also describes some ZPT-specific behaviors that are
  not part of the standards.

    % snell - Nov. 15, 2003 5:20 am:
     There is no reference to metal:block
     Zope Page Templates Reference
     Page Templates
     Advanced Page Templates
     What is it for?

    % Anonymous User - Nov. 23, 2003 3:01 pm:
     tal:block or metal:block can be used on tag-level
     if you have no html-tag to put your tal/metal code on.

    % Anonymous User - Nov. 23, 2003 3:02 pm:
     for instance, outside of the html-tag.

    % Anonymous User - Apr. 14, 2004 10:17 am:
     I have found a tal function that is never used or described in any of these pages or the WWW after a search
     on 5 searchpages. Except in a subproduct for Zope (Plone) (but they don't explain tal usage on their site so
     I'll ask it here)
       <tal:datetime define="today python:DateTime().earliestTime()">

     First thing that intrigues me: There is no standard html tag around this tal, I thought only
     tal:block could do that?
     Second thing I noticed: All the code that remained between those tags (represented by "...") appeared in the
     resulting page without problem, but there remained nothing visible of these "tal:datetime" tags.
     Third thing I noticed: straight after the tal:datetime statement comes define="...", clearly working as the
     tal:define explained later in this apendix. Why has there been no need to write "tal:" in front of it?
     Is this some faulty page template code, yet still beeing accepted by the browser?
     Could this code have been replaced by a simple <tal:block tal:define="..."> ... </tal:block> or <span
     tal:omit-tag tal:define="..."> ... </span>?
     Or is there a possibility to extend the tal-statements and why isn't it told here then?

    % Anonymous User - Apr. 14, 2004 10:30 am:
     You need to understand namespaces. In an HTML page, the default namespace
     is that of HTML. The browser will attempt to parse all tags in this namespace.

     To put a tag in a different namespace, which will be ignored by the browser,
     prefix it with the namespace, e.g. to put a tag in the 'tal' namespace, write:
        <tal:XXXX ... />
     The same goes for attributes. To put an attribute in the 'tal' namespace, 
     write:   <span tal:define="..." />
     If an element is in the 'tal' namespace, all its attributes are also in that
     namespace. That is why it is *not* necessary to write:  
       <tal:datetime tal:define="..." />
     The second 'tal:' is redundant. 

     The next thing to understand: TAL (the Template ATTRIBUTE language) only
     pays attention to *attributes*. It ignores tags. Therefor the XXX in 
       <tal:XXX ...> 
     can be anything -- it will be ignored by the TAL parser. It's a good idea
     to make it something descriptive.

    % Anonymous User - Aug. 6, 2005 6:52 pm:

    % Anonymous User - Aug. 12, 2005 5:02 pm:

    % inflatables - Oct. 14, 2005 11:42 pm:

More information about the ZDP mailing list