[Zope] dtml-in format
Dylan Reinhardt
zope at dylanreinhardt.com
Fri Aug 8 07:52:10 EDT 2003
On Thu, 2003-08-07 at 21:15, Ben Bush wrote:
> How do I address each item in the list? Can you give me an example if I
> were to return a list of integers and a dicitionary list.
Sure. Search the online help for "in" for details.
--------
<dtml-call "REQUEST.set('my_list', [{'foo': 1, 'bar':2},
{'foo': 3, 'bar':5}])">
<dtml-in my_list prefix=list>
foo: <dtml-var "list_item['foo']">
bar: <dtml-var "list_item['bar']">
</dtml-in>
<dtml-call "REQUEST.set('my_dict', {'foo': 7, 'bar':8})">
<dtml-in "my_dict.items()" prefix=dict>
<dtml-var dict_key>: <dtml-var dict_item>
</dtml-in>
-------
Running the above should produce:
foo: 1
bar: 2
foo: 3
bar: 5
foo: 7
bar: 8
HTH,
Dylan
More information about the Zope
mailing list