[Zope] - Re: dtml syntax query

Simon Michael simon@joyful.com
Tue, 5 Jan 1999 12:07:13 -0800


meant to cc the list.

To: Tim Fraser
Subject: RE: [Zope] - dtml syntax query


> I wondered what the id[0:5] means?

I can answer that.. :) This is python notation for "the first 5 characters
of the id  string". You can find more details on this notation in the python
tutorial at www.python.org.

> I want to insert a tag in a new page which will iterate through a number
> of created "polls"(id's are p1,p2,p3...), all of which exist in one
> folder and which will dynamically create a list of links.
>
> After reading the DTML User Guide I'm still unclear.  The "in" tag seems
> the correct choice. However I can't seem to arrive at the correct
> syntax.

I'll take a stab at this too.. there's more info on #in syntax in
.../lib/python/DocumentTemplate/DT_In.py. Maybe these snippets will be of
some help:

A very simple list of hyperlinks to subobjects:

<!--#in objectItems -->
<A HREF="<!--#var sequence-key -->"><!--#var sequence-key --></A><br>
<!--#else-->
No items
<!--#/in-->

A tree, sorted by object id, listing only objects for which you have access
rights. I use an #if statement to hide User Folders. You might need to
adjust the HREF and TARGET:

<!--#tree sort=id nowrap=1 skip_unauthorized=1-->

<!--#if expr="_vars['tree-item-url'][-9:]=='acl_users'"-->
<!--#else-->
  <A HREF="<!--#var tree-item-url-->/main" TARGET="main"><!--#var id--></A>
<!--#/if-->

<!--#/tree-->


-Simon