I have solved it in the following way:
#set $archive_data = [($day, $day(data_binding='sdr_binding'),
$day(data_binding='sdr2_binding')), ($week,
$week(data_binding='sdr_binding'), $week(data_binding='sdr2_binding')),
($month, $month(data_binding='sdr_binding'),
$month(data_binding='sdr2_binding')), ($year,
$year(data_binding='sdr_binding'), $year(data_binding='sdr2_binding'))]
....
<tr>
<td class="label">$obs.label.outTemp</td>
<td class="units">$unit.label.outTemp</td>
#for $archive in $archive_data
<td class="data
new_row">$archive[0].outTemp.max.format(add_label=False)<br/>
<span class="timestamp">$archive[0].outTemp.maxtime</span><br/>
$archive[0].outTemp.min.format(add_label=False)<br/>
<span class="timestamp">$archive[0].outTemp.mintime</span>
</td>
#end for
</tr>
<tr>
<td class="label">$obs.label.extraTemp6</td>
<td class="units">$unit.label.extraTemp6</td>
#for $archive in $archive_data
<td class="data new_row">
$archive[1].extraTemp6.max.format(add_label=False)<br/>
<span
class="timestamp">$archive[1].extraTemp6.maxtime</span><br/>
$archive[1].extraTemp6.min.format(add_label=False)<br/>
<span class="timestamp">$archive[1].extraTemp6.mintime</span>
</td>
#end for
</tr>
Auchtermuchty Weather schrieb am Samstag, 13. März 2021 um 12:37:51 UTC+1:
> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/6224f9cb-2f8f-4e22-80d6-641414880bc7n%40googlegroups.com.