Temperature
This program dispaly weekly temptures. weekTemp is a list of items for each day of a week. len is the number of elements for each day. The structure is {day high low}. You can get yesterday and tomorrow by computing.
WMLHeader temp.wml
proc WeekTemp {weekTemp len} {
set n 0
set m [llength $weekTemp]
foreach {day high low} $weekTemp {
# get days by mod computing
set yesterday [lindex $weekTemp [expr ($n-$len)%$m]]
set tomorrow [lindex $weekTemp [expr ($n+$len)%$m]]
'accept' goes to yesterday card and 'options' goes to tomorrow card.
dispaly today's high tempture and low tempture.
_card "id='card_$day' title='$day'"
_do "type='accept' label='$yesterday'"
__go "href='#card_$yesterday'"
do_
_do "type='options' label='$tomorrow'"
__go "href='#card_$tomorrow'"
do_
_p "align='center'"
quote "Today [_b_ $day] Temp "; __br; __br
quote "High: $high"
__br
quote "Low: $low"
p_
card_
incr n $len
}
}
set temp as a list of {day high low}. The attribute http-equiv specifies the cache control
which is interpreted by HTTP server. content='max-age=0' will upgrade the cache
immediately. forua='true' specifies that the property will reach to microbrowser.
# {day high low} list
set temp {
Sun 79 30
Mon 68 20
Tue 74 32
Wed 77 40
Thu 73 38
Fri 69 39
Sat 71 41
}
_wml
_head
__meta "http-equiv='Cache-Control'
content='max-age=0'
forua='true'"
__meta "http-equiv='Cache-Control'
content='must-revalidate'
forua='true'"
head_
WeekTemp $temp 3
wml_
|