[Zope] Newbie: help with math syntax?

Phil Harris phil@philh.org
Thu, 16 Sep 1999 22:39:13 +0100


Try

<!--#if number1-->
<!--#if number2-->
<!--#if number3-->
<!--#var "number1 + number2 + number3"-->
<!--#/if-->
<!--#/if-->
<!--#/if-->

HTH

Phil
phil@philh.org

----- Original Message ----- 
From: David Robson <robson555@yahoo.com>
To: Zope Discussion List <zope@zope.org>
Sent: Thursday, September 16, 1999 7:43 PM
Subject: [Zope] Newbie: help with math syntax?



...in fact I'm not quite experienced enough to be a newbie. 

I'm trying to write a series of simple DTML Documents to learn syntax.
I've read lots of Zope docs but haven't found an example of add,
subtract, multiply, divide.  (Probably too simple.) Here's my
unsuccessful attempt in two DTML pages:


Code for index_html


<!--#var standard_html_header-->
<h2><!--#var title_or_id--></h2>
<p>
This is the <!--#var id--> Document.
<BLOCKQUOTE>

<FORM ACTION="addTotal">
<P>Enter a number:
<INPUT TYPE="text" SIZE="3" NAME="number1"></P>
<P>Enter a number:
<INPUT TYPE="text" SIZE="3" NAME="number2"></P>
<P>Enter a number:
<INPUT TYPE="text" SIZE="3" NAME="number3"></P>

<INPUT TYPE="submit" VALUE="Compute">
</FORM>

</p>
</BLOCKQUOTE>
<!--#var standard_html_footer-->

/\/\/\/\/\/\

The above DTML Document seems to work OK. It calls the DTML Document
addTotal which reads back the parameters OK but won't sum them.no doubt
because I'm using the wrong syntax. Here's code for addTotal including
my unsuccessful guesses.



<!--#var standard_html_header-->
<h2><!--#var title_or_id--></h2>

<P>The first number is <!--#var number1--></P>

<P>The second number is <!--#var number2--></P>

<P>The third number is <!--#var number3--></P>

The total is: 
<!--#var number1-->+<!--#var number2-->+<!--#var number3--><BR>

Not!</P>

<P>Perhaps the total is: 
<!-- expr="#var number1+#var number2+#var number3"-->
<!-- #var expr="#var number1+#var number2+#var number3"-->
<!-- #var expr(#var number1+#var number2+#var number3)-->
<!-- #var expr(#var number1+#var number2+#var number3)-->
<!-- expr(#var number1+#var number2+#var number3)-->
<!-- expr("#var number1+#var number2+#var number3")-->
<!-- #var expr(#var number1+#var number2+#var number3)-->
<!-- #var expr("#var number1+#var number2+#var number3")-->
<!-- expr(#var "number1"+"#var number2"+"#var number3")-->
<!-- expr(#var "number1+#var number2+#var number3")-->
<!-- #var expr(#var number1+#var number2+#var number3)-->
<!-- #var expr("#var number1"+"#var number2"+"#var number3")-->

<BR><BR>Still not!<BR><BR>

<!--#var standard_html_footer-->


/\/\/\/\

Can someone please write the correct sum expression for me?
While you're at it, how about the expression for finding the square
root of one of the numbers?

Thanks!


===

David Robson            robson555@yahoo.com
Computer Support        Towson High School, MD, USA

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com

_______________________________________________
Zope maillist  -  Zope@zope.org
http://www.zope.org/mailman/listinfo/zope

(To receive general Zope announcements, see:
http://www.zope.org/mailman/listinfo/zope-announce

For developer-specific issues, zope-dev@zope.org -
http://www.zope.org/mailman/listinfo/zope-dev )