ZPT-JS reference - Attributes - TALContent

Syntax

argument ::= ('structure') expression
                

Description

The data-content inserts text or structure in place of its children. It replaces the statement element with either text or a structure (unescaped markup). The body of the statement is an expression with an optional type prefix. The value of the expression is converted into an escaped string if you prefix the expression with text or omit the prefix, and is inserted unchanged if you prefix it with structure. Escaping consists of converting “&” to “&amp;”, “<” to “&lt;”, and “>” to “&gt;”.

If the expression evaluates to nothing, the statement element is left childless. If the expression evaluates to default, then the element’s contents are unchanged.

Note: some parts extracted from Zope Page Templates Reference.

Differences with ZPT

Examples

Inserting the user name:

                    <p data-content="user/name">Fred Farkas</p>
                

Inserting HTML/XML:

                    <p data-content="structure myFormattedText">
                        marked <strong>up</strong> content goes here.
                    </p>
                

Note: extracted from Zope Page Templates Reference.