dedecms如何使用{dede:list}标签中的if判断条件
if判断条件在开发过程中经常用到,那么在dedecms的{dede:list}标签中如何使用if条件判断呢?我们可以参考下面的代码:
{dede:list pagesize=’10’}
<ul>
<li><a href=”[field:arcurl/]” rel=”external nofollow” rel=”external nofollow” rel=”external nofollow” rel=”external nofollow” target=”_blank”>[field:array runphp=’yes’]@me = (empty(@me[‘litpic’]) ? “” : “<img src='{@me[‘litpic’]}’ width=’217′ height=’167′ border=’0′ />”); [/field:array]</a></li>
<li class=”ht”><a href=”[field:arcurl/]” rel=”external nofollow” rel=”external nofollow” rel=”external nofollow” rel=”external nofollow” target=”_blank”>[field:title/]</a></li>
<li><a href=”[field:arcurl/]” rel=”external nofollow” rel=”external nofollow” rel=”external nofollow” rel=”external nofollow” target=”_blank”><img src=”/img/bw.jpg” width=”154″ height=”32″ border=”0″ /></a></li>
</ul>
{/dede:list}
另一种形式的if判断应用示例代码:
{dede:list pagesize=’33’}
<li class=”hang”>
<a href=”[field:arcurl/]” rel=”external nofollow” rel=”external nofollow” rel=”external nofollow” rel=”external nofollow” target=”_blank”>[field:title /]</a>
<span class=”sj”>
[field:pubdate function=”MyDate(‘Y-m-d’,@me)”/]
</span>
</li>
[field:global runphp=’yes’ name=autoindex]
$c = ‘<li class=”xian”></li>’;
if((@me % 6) == 0) @me = $c;
else @me = ”;
[/field:global]
{/dede:list}
文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/114831.html<