| |
Nesting dtml-in tags using the prefix attribute
Submitted by: mlm
Last Edited: 2004-10-14
Category: DTML
|
| Average rating is:
5.0 out of 5
|
(1 ratings) |
|
Description:
When nesting dtml-in tags values of variables defined by outer dtml-in tags are often needed within an inner dtml-tag. However, the default variables defined by the inner tag (sequence-item, e.g.) shadow the variables of the same name defined by outer tags.
|
Source (Text):
<dtml-in expr="('A', 'B', 'C')" prefix="letter">
<dtml-in expr="('0', '1', '2')" prefix="number">
&dtml-letter_item;&dtml-number_item;
</dtml-in>
</dtml-in>
|
Explanation:
Make the variables of each level of nested dtml-in have unique names
by specifying a different value for each one's prefix attribute.
(The innermost tag doesn't need a prefix attribute, but it seems preferable to be
consistent by including one.)
Note that the variables defined when the prefix attribute is specified use underscores
instead of dashes (which, by the way, makes them acceptable to Python code
inside expr= expressions).
|
Comments:
No Comments
|
|