[Zope] Feeling like a newbie.. document id if statement?
Marcel Preda
marcel@punto.it
Wed, 24 May 2000 17:07:27 +0200
----- Original Message -----
From: Timothy Wilson <wilson@visi.com>
> On Wed, 24 May 2000, Rik Hoekstra wrote:
>
..
> > > Ok.. this is really dumb, but for some reason I can't get this to work.
> > >
> > > <dtml-if "id=='index_html'">
> >
> > I believe this should be
> >
> > <dtml-if "_['id']=='index_html'">
>
> I wonder if someone would be kind enough to translate Rik's code into Enlish
> for me. I know that expressions inside "" are Python, but what is the
> function of the [] and _?
>
The special "namespace" variable, "_"
It is useful to access the variables with special names, like "sequence-index"
For example:
<dtml-if "sequence-index==3" > will not work
"sequence MINUS index==3" :-)
You have to use <dtml-if "_['sequence-index']==3" >
In fact "_['id']" is the some thing with "id" , I presume (or maybe I'm wrong).
so, is no difference between
<dtml-if "id=='index_html'">
&&
<dtml-if "_['id']=='index_html'">
Find more @:
http://www.zope.org/Documentation/Guides/DTML-HTML/DTML.5.3.2.3.html
Marcel