----- Original Message ----- From: "James W. Howe" <jwh@allencreek.com> To: <zope@zope.org> Sent: Monday, February 28, 2000 1:07 PM Subject: [Zope] Returning lists of tuples
I've got situation where I want a dtml-method to return a list of tuple objects. I then want to iterate over the tuples using a dtml-in construct, displaying the various parts of the tuple. For example, suppose I want to return a list of URL tags and names like this:
<dtml-return "[('Go Here', 'foo.bar.com') , ('Go Somewhere Else', 'baz.foo.com')]">
I would like to do something like this with this result:
<dtml-in urltags> <a href="< url part from tuple >">< display part of tuple ></a> </dtml-in>
Is there a way to do this and if so, what is the magical syntax to make this happen? I'm also interested in knowing how I might use a collection of mapping objects in a similar manner.
(untested): <dtml-in urltags> <a href="<dtml-var "_['sequence-item'][1]">"><dtml-var "_['sequence-item'][0]"></a> </dtml-in> The syntax is somewhat verbose, but should do the trick just fine. Kevin