eyoucms如何判断第一条和最后一条数据
2022-11-28 加入收藏
一、第一条的判断
判断代码{eyou:eq name='$i' value='1'} 输出值{/eyou:eq},arclist与list都可以
1 2 3 4 5 6 7  | {eyou:list pagesize='20' titlelen='40'}{eyou:eq name='$i' value='1'}<!--判断开始-->  <a href="{$field.arcurl}">{$field.title}</a><!--第一条-->{else /}<!--判断第一条结束-->  <a href="{$field.arcurl}">{$field.title}</a><!--余下条数-->{/eyou:eq}<!--判断结束-->{/eyou:list} | 
可应用于比如给第一条数据不同的样式。
1 2 3 4 5  | {eyou:arclist titlelen='20' row='30'}<li {eyou:eq name='$i' value='1'} class="pl"{/eyou:eq} ><a href="{$field.arcurl}" title="{$field.title}" class="protitle">{$field.title}</a> <li>{/eyou:arclist} | 
二、最后一条的判断
eq与neq的用法,结合$__LIST__|count=###
比如给最后一条数据加条竖线
1 2 3 4 5 6  | {eyou:channel type="top" row="10" id="field" currentstyle="cur"}<a href="{$field.typeurl}">{$field.typename}</a>{eq name='$i' value='$__LIST__|count=###'}<span>|</span> {/eq}{/eyou:channel} | 
最后一条数去掉竖线。
1 2 3 4 5 6  | {eyou:channel type="top" row="10" id="field" currentstyle="cur"}   <a href="{$field.typeurl}">{$field.typename}</a>{neq name='$i' value='$__LIST__|count=###'}<span>|</span> {/neq}{/eyou:channel} |