[Zope] <dtml-in> looping over lines in document
Dieter Maurer
dieter@handshake.de
Fri, 11 May 2001 21:39:45 +0200 (CEST)
Laurie Nason writes:
> Is it possible to use <dtml-in> over a DTML method's text and get each line
> out one by one. I know there is a lines property but am not sure how or if
> it can be used in this context.
It is possible provided your user has the necessary permissions:
<dtml-in "_.string.split(<your method>.document_src(),'\n')">
...
</dtml-in>
> The reason I am asking is that I am trying somehow to store my lookup values
> for my select boxes in one folder with each lookup having a separate DTML
> method containing the values. If anyone has a better idea, please let me
> know.
A "lines" or "tokens" property is good for this.
We also often use:
<dtml-return "('opt1','opt2','opt3',....)">
This also allows to compute your option values based on the context.
You would use it:
<dtml-in <your_method>>
....
Dieter