cms比较容易写出循环的网页内容,对于有些循环的网页内容有不同css设定,这样在写cms时需要对循环做出条件判断:{if 判断条件}输出内容{else}输出内容{/if}。通过判断可以实现图片轮播效果,某些单独突出显示的内容
<ul class="pro-list"> {pc:content action="category" catid="21" num="4" siteid="$siteid" order="listorder ASC"} {loop $data $key $r} {if $key==40} <li class="item0"> <a title="{$r[catname]}" href="{$r[url]}"> <div class="div-img" style="height:auto"> <img alt="{$r[catname]}" src="{$r[image]}" class="Animation"> </div> <div class="pro_box Themebg Animation"> <h5 class="overflow">{$r[catname]}</h5> <p></p> </div> </a> </li> {else} <li class="item1"> <a title="{$r[catname]}" href="{$r[url]}"> <div class="div-img" style="height:auto"> <img alt="{$r[catname]}" src="{$r[image]}" class="Animation"> </div> <div class="pro_box Themebg Animation"> <h5 class="overflow">{$r[catname]}</h5> <p></p> </div> </a> </li> {/if} {/loop} {/pc} </ul>
通过if判断实现一张大图和四个小图