1 <volist name="data" id="vo"> 2 <div class="case1_01 flexslider"> 3 <span class="case1_01s1">{$vo['title']}</span> 4 <ul class="case1_01d1 slides"> 5 <foreach name="vo['content']" item="v" key="k"> 6 <if condition="($k+4)%4 eq 0"> <li class="case1_01d3"></if> 7 <img src="{$v}" alt="" class="case1_01i1"> 8 <if condition="($k+1)%4 eq 0"> </li></if> 9 </foreach> 10 </ul> 11 <div class="case1_01d2"> 12 <span class="bt_lf" style="float: left;"> 13 <img src="__PUBLIC__/home/images/case01.png" alt="" class="case1_01i2 zuo"> 14 <span class="case1_01s2 yeshu">1</span> 15 </span> 16 <img src="__PUBLIC__/home/images/case03.png" alt="" class="case1_01i2"> 17 <span class="bt_rt" style="float: left;"> 18 <span class="case1_01s2 zongshu"></span> 19 <img src="__PUBLIC__/home/images/case02.png" alt="" class="case1_01i2 you"> 20 </span> 21 </div> 22 <div class="ffmengban" style="width: 1060px;height:550px;padding-bottom: 45px"> 23 <div class="zhuti" style="width:1060px;height:550px;"> 24 <img src="" alt="" class="bpic casecenpic" style="width: 800px;height: 550px"> 25 <img src="__PUBLIC__/home/images/right.jpg" alt="" class="right r1" style="left: 990px;top: -340px"> 26 <img src="__PUBLIC__/home/images/left.jpg" alt="" class="left lef1" style="right: 70px;top: -340px"> 27 <img src="__PUBLIC__/home/images/hide.jpg" alt="" class="xhide xhie1" style="left:820px;top: -640px;height: 50px;width: 50px;"> 28 </div> 29 </div> 30 </div> 31 </volist>
或者 直接用 volist标签内置
偶数输出
<volist name="list" id="vo" mod="2" >
<eq name="mod" value="1">{$vo.name}</eq>
</volist>
输出循环变量
- <volist name="list" id="vo" key="k" >
- {$k}.{$vo.name}
- </volist>
如果没有指定key属性的话,默认使用循环变量i,例如:
- <volist name="list" id="vo" >
- {$i}.{$vo.name}
- </volist>
如果要输出数组的索引,可以直接使用key变量,和循环变量不同的是,这个key是由数据本身决定,而不是循环控制的,例如:
- <volist name="list" id="vo" >
- {$key}.{$vo.name}
- </volist>