[Zope] RE: [Zope-dev] variables in zope (beginner question)

sean.upton@uniontrib.com sean.upton@uniontrib.com
Mon, 11 Mar 2002 17:04:00 -0800


Please consider directing this to zope@zope.org, not zope-dev@zope.org...
I've cc'd that list.

The DTML you have is wrong (you can't nest DTML tags), if you use DTML for
logic, things can get messy.  Consider putting your code in a python script
and call that from DTML or Page templates...

You don't need to daclare a variable if you are using a python script, just
assign a value to it in your loop.  Perhaps the Python Tutorial at
python.org might be a good place to start.  Doing this kind of thing in DTML
is a bit more messy: my suggestion, do it in a Python script.

Sean

-----Original Message-----
From: Mike Guerrero [mailto:mguerrero@tachyon.net]
Sent: Monday, March 11, 2002 4:39 PM
To: zope-dev@zope.org
Subject: [Zope-dev] variables in zope (beginner question)


Hello,

I the code below I want to be declare a variable 'tot_net_amt' and add
'net_amt' to it for each record returned.  How can I: 1) declare the
variable  2) add to it within the loop.

Thanks.  Is it in the Zope book?  I'll read some more tonight.

Thanks for your help.

Mike



<dtml-var standard_html_header>
<h3>Current Month</h3>

<!-- declare tot_net_amt  int := 0;  --->

<table border="1" cellspacing="0">
<tr>
    <th><font size="1">Sales Order No.</font></th>
    <th><font size="1">Net Amt.</font></th>
</tr>
<dtml-in sql_curr_month_decom>
  <tr>
      <!--- net_tot_amt := net_tot_amt + <dtml-var net_amt>  --->

      <td align="center"><font size="1"><dtml-var sales_ord_no></font></td>
      <td align="center"><font size="1"><dtml-var net_amt></font></td>
  </tr>
</dtml-in>
</table>
<dtml-var standard_html_footer>


_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )