ZPT-JS reference - Attributes - TALReplace

Syntax

argument ::= ('structure') expression
                

Description

The data-replace statement replaces an element with dynamic content. It replaces the statement element with either text or a structure (unescaped markup). The value of the expression is converted into an escaped string if you 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 value is nothing, then the element is simply removed. If the value is default, then the element is left unchanged.

Note: zome parts extracted from Zope Page Templates Reference.

Differences with ZPT

Examples

Inserting the title of a template:

                    <span data-replace="myObject/title">Title</span>
                

Inserting HTML/XML:

                    <div data-replace="structure table" />
                

Inserting nothing:

                    <div data-replace="nothing">
                        This element is a comment.
                    </div>
                

Note: extracted from Zope Page Templates Reference.