"George M. Ellenburg" wrote:
On Wednesday 08 May 2002 08:19 am, Gilles Durys wrote:
You should use this: <dtml-if expr="a=='3'"> <!-- blablabla --> </dtml-if>
a=='3' test is a equals '3' (I think form values are always strings - not sure though)
not always. you may type form variables, and ZPublisher converts them for you see http://www.zope.org/Members/Zen/howto/FormVariableTypes http://www.zope.org/Members/hawkfish/radio_records
a=3 assigns the value 3 to a
On Wednesday 08 May 2002 09:19 am, hans wrote:
it took me some time to understand, but basically there are 2 different ways for name resolution. name=... is DTML searching, expr="..." is python searching (everything in " " is python). a name-attribute may consist only of one identifier (thats why syntax error!) (in <dtml-if name=myid>, nonexistence is treated as falsehood).
On Wednesday 08 May 2002 08:22 am, Geir Bækholt wrote:
<dtml-if "tip == 1"> .. or even clearer : <dtml-if expr="tip == 1">
eveluations like this have to be done as python expressions , hence the quotes (they are really just a shorthand for expr="" , and have served to confuse many a newbie....)
Okay,
So if I understand this correctly, even though the expr is called, and it's evaluating outside the scope of the website, will Python then eventually evaluate it *in* the scope of the website (through acquisition or inheritence or whatever?)
Sorry, I'm *so* not an OO programmer. ;-)
Wouldn't (or couldn't) there be a name-collision if I'm passing a variable/ constant that's already defined (or reserved)?
again: <dtml-var name="theName">: the DTML-interpreter looks up theName in the namespace. If it exists, AND is callable, it calls it and replaces w the result thereof. nonexistence raises exception. <dtml-var theName> is a shorthand. <dtml-if theName>: nonexistence is falsehood. <dtml-var expr="any-python-expression">: The DTML-interpreter lets (restricted) python evaluate this (giving python also the namespace) <dtml-var "theName"> shorthand for expr="theName" if theName is callable, it will not be called! <dtml-if "theName">: nonexistence is error ------------------------------------------------------------- Who's got only a hammer sees the world as a nail hans augustin (software developer) hans@beehive.de beehive elektronische medien GmbH http://www.beehive.de phone: +49 30 847-82 0 fax: +49 30 847-82 299