class Poodle_Output_TPL_MHX
class Poodle_Output_TPL_MyName
The CMS uses a template system based on Zope's TAL system (wikipedia).
However, METAL is not supported.
More information can be found at:
Using Zope Page Templates
Advanced Page Templates
Appendix C: Zope Page Templates Reference
TAL consists of seven different commands (highest priority first):
define, condition, repeat, content, replace, attributes, and omit-tag.
Commands are attributes on HTML or XML tags, e.g. <div tal:content="article">Article goes here</div>
Syntax: tal:define="[local | global] name expression [; define-expression...]</p> </p><p>Description: Sets the value of "name" to "expression". By default the name will be applicable in the "local" scope, which consists of this tag, and all other tags nested inside this tag. If the "global" keyword is used then this name will keep its value for the rest of the document.
Example: <div tal:define="global title book/theTitle; local chapterTitle book/chapter/theTitle">
Syntax: tal:condition="expression"
Description: If the expression evaluates to true then this tag and all its children will be output. If the expression evaluates to false then this tag and all its children will not be included in the output.
Example: <h1 tal:condition="IDENTITY/isAdmin">Welcome admin to this page!</h1>
Syntax: tal:condition-else="expression"
Description: This attribute is added in our system to construct faster if/elseif/else blocks. If the expression is omitted it is interpreted as the else block, else it is an elseif block. If the expression evaluates to true then this tag and all its children will be output. If the expression evaluates to false then this tag and all its children will not be included in the output.
Example: <h1 tal:condition-else="IDENTITY/isMember">Welcome member to this page!</h1>
Syntax: tal:repeat="name expression"
Description: Evaluates "expression", and if it is a sequence, repeats this tag and all children once for each item in the sequence. The "name" will be set to the value of the item in the current iteration, and is also the name of the repeat variable. The repeat variable is accessible using the TAL path: repeat/name and has the following properties:
Example:
<table>
<tr tal:repeat="fruit basket">
<td tal:content="repeat/fruit/number"></td>
<td tal:content="fruit/name"></td>
</tr>
</table>
Syntax: tal:content="[text | structure] expression"
Description: Replaces the contents of the tag with the value of "expression". By default, or if the "text" keyword is present, the value of the expression will be escaped as required (i.e. characters "&<> will be escaped). If the "structure" keyword is present then the value will be output with no escaping performed.
Example: <h1 tal:content="IDENTITY/nickname"></h1>
Syntax: tal:replace="[text | structure] expression"
Description: Behaves identically to tal:content, except that the tag is removed from the output (as if tal:omit-tag had been used).
Example: <h1>Welcome <b tal:replace="IDENTITY/nickname"></b></h1>
Syntax: tal:attributes="name expression[;attributes-expression]"
Description: Evaluates each "expression" and replaces the tag's attribute "name". If the expression evaluates to nothing then the attribute is removed from the tag. If the expression evaluates to default then the original tag's attribute is kept.
Example: <a tal:attributes="href IDENTITY/website;title IDENTITY/nickname">Your Homepage</a>
Syntax: tal:omit-tag="expression"
Description: Removes the tag (leaving the tags content) if the expression evaluates to true. If expression is empty then it is taken as true.
Example: <h1><b tal:omit-tag="not:IDENTITY/isMember">Welcome</b> to this page!</h1>
The expressions used in TAL are called TALES expressions. The simplest TALES expression is a path which references a value, e.g. RESOURCE/body references the body property of the resource object.
Syntax: [path:]string[|TALES Expression]
Description: A path, optionally starting with the modifier 'path:', references a property of an object. The '/' delimiter is used to end the name of an object and the start of the property name. Properties themselves may be objects that in turn have properties. The '|' ("or") character is used to find an alternative value to a path if the first path evaluates to 'Nothing' or does not exist.
Example: <p tal:content="book/chapter/title | string:Untitled"></p>
There are several built in paths that can be used in paths:
There are also several built in default context properties that can be used:
Syntax: exists:path
Description: Returns true if the path exists, false otherwise. This is particularly useful for removing tags from output when the tags will have no content.
Example: <h2 tal:condition="exists:book/chapter/title" tal:content="book/chapter/title"></h2>
Syntax: not:tales-path
Description: Returns the inverse of the tales-path. If the path returns true, not:path will return false.
Example: <p tal:condition="not:IDENTITY/isMember">Welcome anonymous to the site!</p>
Example: <p tal:condition="not:php:0 == ${IDENTITY/id}">Welcome anonymous to the site!</p>
Syntax: string:text
Description: Evaluates to a literal string with value text while substituting variables with the form ${pathName} and $pathName
Example: <b tal:content="string:Welcome ${IDENTITY/nickname}!"></b>
Example: <b tal:content="'Welcome ${IDENTITY/nickname}!'"></b>
Syntax: php:php-code
Description: Evaluates the php-code and returns the result. The PHP code must be properly escaped, e.g. "php: 1 < 2" must be written as "php: 1 < 2". The PHP code has access to many PHP functions, including the TALES path as ${path}
Example: <div tal:condition="php: ${basket/items} > 0">Checkout!</div>