For Loop tag, for tag
Function: loop tag
Objects (schoolbags) can be recycled from small to large, or from large to small
If the object (schoolbag) parameter is not specified, a default cyclic object (schoolbag) is generated)
Nested loops
Usage:
<For bags = [schoolbag 1 | schoolbag 2 |...] [start = start value] [end = end value] [step = step value]>
<Cyclic tag>... </cyclic tag>
</For>
· Bags
· Start: start value. The default value is 0.
· End: the end value. The default value is 10.
· Step: step size. The default value is 1.
· Cyclic tags: WebEasy Language tags or html tags, which cannot be blank
chtml><for><b>@{for:getSuffix}-</b></for></chtml>
From 0 to 10, the last digit is less than 10,
(Example file: _ samples/for.html)
Example above: A big data application example of Traffic Analysis
List name
<Ul> <li style = "width: 917px; border-top: 0px; border-left: 0px "> <B> Real-time Data </B> </li> </ul> <li style =" width: 171px; background-color: # 008B8B; "> time </li> <li style =" width: 70px; background-color: # 008B8B; "> guest </li> <li style =" width: 120px; background-color: # 008B8B; "> ip </li> <li style =" width: 280px; background-color: # 008B8B; "> from </li> <li style =" width: 280px; background-color: # 008B8B; border-right: 1px # B4B4B4 solid; "> access address </li> </ul>
Query real-time traffic records (vertica database)
<esql module=vertica id=list>select ts,uid,client_ip,case when ref_protocol='' then '' else ref_protocol||'://'||ref_host||ref_uri || (case when ref_para='' then '' else '?' || ref_para end) end as ref,case when page_protocol='' then '' else page_protocol||'://'||page_host||page_uri||(case when page_para='' then '' else '?'||page_para end) end as page from roi.visit_log @{pPage:where} order by ts desc limit 100;</esql>
Use
For tag LoopOutput custom list (Note: bags = list)
<For bags = list end = "@ {list: getLength}"> <ul> <li style = "width: 171px" >@{ intLeft :@{ list: ts} (19)} </li> <li style = "width: 70px" >@{ list: uid} </li> <li style = "width: 120px ">@{ list: client_ip} </li> <if x =" {list: ref} "else = 1> <li style =" width: 280px "> direct access </li> <li style =" width: 280px "> <a href =" @ {list: ref} "target = _ blank >@{ intleft: @ {list: ref} (30) }</a> </li> </if> <li style = "width: 280px; border-right: 1px # B4B4B4 solid; "> <a href =" @ {list: page} "target = _ blank >@{ intleft :@{ list: page} (30 )} </a> </li> </ul> </for>
Complete code
<Div id = tab980> <ul> <li style = "width: 917px; border-top: 0px; border-left: 0px "> <B> Real-time Data </B> </li> </ul> <li style =" width: 171px; background-color: # 008B8B; "> time </li> <li style =" width: 70px; background-color: # 008B8B; "> guest </li> <li style =" width: 120px; background-color: # 008B8B; "> ip </li> <li style =" width: 280px; background-color: # 008B8B; "> from </li> <li style =" width: 280px; background-color: # 008B8B; border-right: 1px # B4B4B4 so Lid; "> access address </li> </ul> <chtml> <if x =" @ {pPage: p_host} "else = 1> <we/> <bag id = pPage> <we name = where> where page_host = '@ {pPage: p_host} '</we> </bag> </if> <esql module = vertica id = list> select ts, uid, client_ip, case when ref_protocol = ''then'' else ref_protocol | ': //' | ref_host | ref_uri | (case when ref_para = ''then'' else '? '| Ref_para end) end as ref, case when page_protocol = ''then'' else page_protocol | ': // '| page_host | page_uri | (case when page_para = ''then'' 'else '? '| Page_para end) end as page from roi. visit_log @ {pPage: where} order by ts desc limit 100; </esql> <for bags = list end = "@ {list: getLength} "> <ul> <li style =" width: 171px ">@{ intLeft :@{ list: ts} (19 )} </li> <li style = "width: 70px" >@{ list: uid }</li> <li style = "width: 120px" >@{ list: client_ip} </li> <if x = "@ {list: ref}" else = 1> <li style = "width: 280px "> direct access </li> <li style =" width: 280px "> <a href =" @ {list: ref} "target = _ blank >@{ intleft: @ {list: ref} (30) }</a> </li> </if> <li style = "width: 280px; border-right: 1px # B4B4B4 solid; "> <a href =" @ {list: page} "target = _ blank >@{ intleft :@{ list: page} (30 )} </a> </li> </ul> </for> </chtml> <ul> <li style = "width: 171px; background-color: # 008B8B; border-bottom: 1px # B4B4B4 solid; "> time </li> <li style =" width: 70px; background-color: # 008B8B; border-bottom: 1px # B4B4B4 solid; "> guest </li> <li style =" width: 120px; background-color: # 008B8B; border-bottom: 1px # B4B4B4 solid; "> ip </li> <li style =" width: 280px; background-color: # 008B8B; border-bottom: 1px # B4B4B4 solid; "> from </li> <li style =" width: 280px; background-color: # 008B8B; border-bottom: 1px # B4B4B4 solid; border-right: 1px # B4B4B4 solid; "> access address </li> </ul> </div>
Output result
Download and description of light platform Resources
Platform free download: http://download.csdn.net/detail/tx18/8381859
Latest Development Manual download: http://download.csdn.net/detail/tx18/8411089
Development Instance:Light B2C e-commerce websites, Free download: http://download.csdn.net/detail/tx18/8318585
The light-Open Platform will occasionally upgrade to provide more powerful and Easy functions for you. Please pay attention to the latestDevelopment Manual