[Zope] dtml-let + dtml-in question
A. B. Monta
apbmonta at yahoo.com
Mon Oct 6 15:19:25 EDT 2003
1. I'm using DTML to declare some new names in the
namespace and do
simple math, thus:
<dtml-let subtotal_hotel_rate1="_.float(hotel_rate1) *
_.int
(hotel_rate1_days)">
2. I want to display these subtotals if, say,
"hotel_rate1" has a
non-null value. No problem there (at least not any
more thanks to Alexis and Ted!).
3. However, I then want to sum only the subtotals
that get to be
displayed. What's the best way of doing this? I'm
stuck because to
display the subtotals, I've had to close out the
dtml-let tags that
enabled them to be displayed in the first place.
Furthermore, I can't make the calculation of the total
conditional on
there being just one non-null value. This would not
do, for ex:
<dtml-if hotel_rate1>
[calculate some total]
</dtml-if>
because there might be a non-null value for
hotel_rate2 (there are 5
hotel rates total), which has to be accounted for. I
have to calculate all the subtotals and
include them in the mix for the total calculation.
I've thought about looping in the value of *any*
namespace variable
that begins with the string "subtotal_". I'd have to
convert those
strings to floating-point integers before doing the
math. That
approach sounds reasonable to me, but I don't know how
construct the
dtml-in syntax in this case.
Any pointers/redirections/examples are greatly
appreciated.
Cheers,
Anthony
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
More information about the Zope
mailing list