Quoting "Jeffrey P Shell":
> The 'not' TALES namespace is valuable. The downside is that you
> evaluate the expression twice. A good way to work within this is
> something that I did earlier today, outside of this conversation,
> where I evaluate an expression earlier and assign it to a variable:
>
> tal:define="editItems python:here.getMenuItem(...)">
>
> Edit Menu Items
> tal:condition="editItems">
>
> ... (form and table elements, and a loop over editItems
> contained in here if there were results) ...
>
>
>
> tal:condition="not:editItems">
> No menu items available
>
>
>
Another way to do this is to use the python test() function inside
tal:replace to conditionally replace the "if" content with the "else"
content. For example:
Edit Menu Items
... (form and table elements, and a loop over editItems
contained in here if there were results) ...
This technique works well when you have one case which is more
"involved" and can be the default, and another case which is simple text
(like an error message).
-- Brent
-
"The programmer, like the poet, works only slightly removed from pure
thought-stuff. He builds his castles in the air, from air, creating
by exertion of the imagination. Few media of creation are so
flexible, so easy to polish and rework, so readily capable of
realizing grand conceptual structures."
-- Frederick Brooks, Jr., The Mythical Man Month
___
Zope-Dev maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope )