doing {{=link.test1}} will work, but using it like that in a loop
doesn't make sense to me.  You'd need to know the key name every time
so you wouldn't need the loop, you'd just type all the menu items out.
 The way I showed you,  the key in the key,value pair doesn't need to
be known.  Depends on how you need to use it i guess.

On Tue, Dec 23, 2008 at 5:35 PM, mike <michal...@gmail.com> wrote:
>
> Wouldn't {{=item[link]}}  be the same as   {{=link.test1}}  or
> {{=link[test1]}}  as in this example
>
> response.topMenu = [dict(test1='test11', test2='test22')]
>
> {{for link in response.topMenu:}}
>        {{=link.test1}} or  {{=link[test1]}}
> {{pass}}
>
> On Dec 23, 3:40 pm, "Wes James" <compte...@gmail.com> wrote:
>> On Tue, Dec 23, 2008 at 1:32 PM, mike <michal...@gmail.com> wrote:
>>
>> > Thanks for the reply, but just to make it more difficult, what if I
>> > have an array of dict objects.
>>
>> > ex. [dict(test1='test11', test2='test22') ,dict(test1='test11',
>> > test2='test22') ,dict(test1='test11', test2='test22') ,dict
>> > (test1='test11', test2='test22') ]
>>
>> > how to I loop through it.
>>
>> response.topMenu=[dict(test1='test11',
>> test2='test22'),dict(test3='test33', test4='test44')]
>>
>> {{for item in response.topMenu:}}
>> {{for link in item.keys():}}
>> {{=item[link]}}
>> {{pass}}
>> {{pass}}
>>
>> -wj
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to