[Zope-dev] ZPT & Plain Text

Chris Withers chrisw@nipltd.com
Wed, 05 Dec 2001 10:55:45 +0000


Martijn Faassen wrote:
> 
> How would you do repeating texts or conditional texts like this? I mean,
> perhaps it's obvious; I haven't played enough with ZPT yet.

repeat:

<x tal:repeat="object here/collection"
   tal:omit-tag="">
I am <y tal:replace="object/id" />
</x>

condition:

<yes tal:condition="here/has_objects_in_basket"
     tal:omit-tag="">
You have <c tal:replace="here/basket_count"/> objects in your basket
</yes>
<no tal:condition="not here/has_objects_in_basket"
     tal:omit-tag="">
Your basket is empty
</no>

> I also think this looks rather unnatural when doing email templates or SQL
> templates.

I used to think that, I'm quickly changing positions. Perhaps the only option
I'd like is a check box somewhere on the template object saying something like
"always include tal:omit-tag by default. Then I reckon it could do for
everything :-)

cheers,

Chris -- more and more a ZPT-ONLY! fan each day...