I was struggling to declare on in a .inc file but it's sorted now using all 
square brackets.

#set $Items = [
[''Tom', 'Happy'}, 
['Dick', 'Sad'}, 
['Harry', 'Hairy'}
]

On Saturday, 13 March 2021 at 12:05:44 UTC gjr80 wrote:

> What exactly is your problem? Works fine for me:
>
> <strong>How are you feeling?</strong>
> <ul>
>         <li>
>             Tom is Happy
>         </li>
>         <li>
>             Dick is Sad
>         </li>
>         <li>
>             Harry is Hairy
>         </li>
> </ul>
>
> Gary
>
> On Saturday, 13 March 2021 at 21:37:51 UTC+10 Auchtermuchty Weather wrote:
>
>> I could do with being able to declare a 2D array in my template.  I found 
>> the following example in the Cheetah documentation but I can't find how to 
>> emulate it in a template:
>>
>> #from Cheetah.Template import Template
>> #extends Template
>>
>> #set $people = [
>> {'name' : 'Tom', 'mood' : 'Happy'}, 
>> {'name' : 'Dick', 'mood' : 'Sad'}, 
>> {'name' : 'Harry', 'mood' : 'Hairy'}
>> ]
>>
>> <strong>How are you feeling?</strong>
>> <ul>
>>     #for $person in $people
>>         <li>
>>             $person['name'] is $person['mood']
>>         </li>
>>     #end for
>> </ul>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/2886c09f-8dba-4ac5-8b01-e8831ee374e2n%40googlegroups.com.

Reply via email to