[Zope] Accessing individual items within a list

Passin, Tom tpassin@mitretek.org
Thu, 29 May 2003 14:04:23 -0400


[McDonnell, Larry]
>...
> If I display <dtml-var pbtemp[sequence-index], I will see ['11', '22',
> '33']. I need to store each variable in the three seperate=20
> rows in a table.
>=20
> Row1 pbtemp[1]
> Row2 pbtemp[2]
> Row3 pbtemp[3]
> I believe I need to use another <dtml-in expr=3D"_.range(3)">=20
> statement but I
> am coming up short in the correct syntax.

First you have to decide what HTML you want to produce.  Then you can
work out how to generate it.

I take it that you want something like this -

<tr><td><input name=3D'name1'></td></tr>
<tr><td><input name=3D'name2'></td></tr>
<tr><td><input name=3D'name2'></td></tr>

This is easy - you just put it into the loop you already have -

<dtml-in expr=3D"_.range(3)">
     <tr><td><input type=3D"text" name=3D"pbtemp[sequence-index]"
size=3D"6"></td></tr>
</dtml-in>

There is no sense trying tp generate anything if you do not know - at
least have a good idea of - the results you want.  Always work out the
html first.

If this is not what you had in mind, then please communciate the output
you want.

Cheers,

Tom P