ZPT Basics (part 1) - Anatomy Lesson (
Page 4 of 5 )
There are a number of TALES expressions in
the code snippet shown in the previous page - here's the first one:
<title tal:content="template/title">The title</title>
As you've already seen, this means "replace the content enclosed within the <title>
element with the result obtained by evaluating the TALES expression [template/title]".
When the template is rendered, this TALES expression will evaluate to the title
of the current page, which will appear within the <title> tag, like this:
<title>Hello ZPT!</title>
The second statement is similar, except that this time, the element itself is
replaced, together with the content enclosed within it. When the page is rendered,
the TAL statement
<h2>Welcome to <span tal:replace="here/title_or_id">content title or
id</span></h2>
will replace the <span>...</span> tags with the results of evaluating the
TALES expression within it, like this:
<h2>Welcome to ZPT Basics</h2>