for迴圈標籤,for標籤
功能:迴圈標籤
對對象(書包)進行迴圈,可以從小到大,也可以從大到小
沒有對象(書包)參數時,會產生一個預設的迴圈對象(書包)
能夠嵌套迴圈
用法:
<for bags=[書包1|書包2|...] [start=起點值] [end=終止值] [step=步長值]>
<被迴圈的標籤>...</被迴圈的標籤>
</for>
· bags:迴圈的目標書包,可多值(能同時對多個書包迴圈),可以從頭到尾遍曆整個書包內容,預設書包名為for
· start:起點值,預設為0
· end:終止值,預設為10
· step:步長,預設為1
· 被迴圈的標籤:WebEasy語言標籤或html標籤,不可為空
chtml><for><b>@{for:getSuffix}-</b></for></chtml>從0迴圈到10,最後一位小於10,
(例子檔案:_samples/for.html)
上執行個體:一個流量分析的大資料應用例子
列表名
<ul><li style="width:917px;border-top:0px;border-left:0px"><b>即時資料</b></li></ul><ul><li style="width:171px;background-color:#008B8B;">時間</li><li style="width:70px;background-color:#008B8B;">訪客</li><li style="width:120px;background-color:#008B8B;">ip</li><li style="width:280px;background-color:#008B8B;">來自</li><li style="width:280px;background-color:#008B8B;border-right:1px #B4B4B4 solid;">訪問地址</li></ul>
查詢即時資料流量記錄(vertica資料庫)
<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)
<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">直接存取</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>完整代碼
<div id=tab980><ul><li style="width:917px;border-top:0px;border-left:0px"><b>即時資料</b></li></ul><ul><li style="width:171px;background-color:#008B8B;">時間</li><li style="width:70px;background-color:#008B8B;">訪客</li><li style="width:120px;background-color:#008B8B;">ip</li><li style="width:280px;background-color:#008B8B;">來自</li><li style="width:280px;background-color:#008B8B;border-right:1px #B4B4B4 solid;">訪問地址</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">直接存取</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;">時間</li><li style="width:70px;background-color:#008B8B;border-bottom:1px #B4B4B4 solid;">訪客</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;">來自</li><li style="width:280px;background-color:#008B8B;border-bottom:1px #B4B4B4 solid;border-right:1px #B4B4B4 solid;">訪問地址</li></ul></div>輸出效果
輕開平台資源下載及說明
平台免費下載:http://download.csdn.net/detail/tx18/8381859
最新開發手冊下載:http://download.csdn.net/detail/tx18/8411089
開發執行個體:輕開B2C電子商務網站,免費下載:http://download.csdn.net/detail/tx18/8318585
輕開平台會不定期升級為大家提供更多強大而Easy的功能,請留意最新的開發手冊