for循环标签

来源:互联网 发布:宏晶单片机 编辑:程序博客网 时间:2024/05/29 13:45

功能:循环标签

对对象(书包)进行循环,可以从小到大,也可以从大到小

没有对象(书包)参数时,会产生一个缺省的循环对象(书包)

能够嵌套循环

  用法:

<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的功能,请留意最新的开发手册

6 0
原创粉丝点击