dedecms的arclist或channel循环中判断第一个li添加

网站建设 2022-07-27 09:12www.1681989.com免费网站
dedecms的arclist循环中,判断如果是第一个li,则添加固定的css,否则不加同样在channel标签里也适用。 写法如下 {dede:arclist row=4 flag=p} li [field:global name =autodex runphp =yes ](@me ==1)? @me =cl […]



dedecms的arclist循环中,判断如果是第一个li,则添加固定的css,否则不加同样在channel标签里也适用。
 
写法如下
{dede:arclist row=4  flag='p'} 
 <li [field:global name=autodex runphp="yes"](@me==1)? @me="class=on":@me="";[/field:global]>[field:global.autodex/]</li> 
{/dede:arclist}
[field:global name=autodex runphp="yes"](@me==1)? @me="class=on":@me="";[/field:global]

这句话的意思就是,如果循环出的是第一个,则添加class=on,否则为空。

 
注意红色部分有两个等号。

channel的判断案例

		
{dede:channel type="son" typeid='23'}
 
<a href="[field:typeurl/]" [field:global name=autodex runphp="yes"](@me==1)? @me="class=_j hover":@me="class=_j";[/field:global]>[field:typename/]</a>
 
{/dede:channel}
 


Copyright © 2016-2025 www.1681989.com 推火网 版权所有 Power by