ak_ifnotempty和ak_if一样,只能用于嵌套,它的支持三个参数:
第一个参数:要判断的变量
第二个参数:如果变量不为空(空字符串)就显示
第三个参数:如果变量为空就显示
常见的用途有:判断评论是否有回复(实例1),判断内容是否有图片(实例2)
实例1:
<{getcomments itemid=$id orderby="id_reverse" num="1000" template="<div class=()post-body()> <img src=()/images/dot2.gif()> [message]<br /><span style='color:red'><#ak_ifnotempty(#)[%review](#)回复:[%review](#)#></span></div><div class=()post-footer()>IP段:[secretip] | [username] 发表于 [y]-[m]-[d] [h]:[i]:[s] </div>" colspan="1" overflow="<hr />"}>
实例2:
<{getitems category="1,2,3" template="<#ak_ifnotempty(#)[%picture](#)<img class='dgestimg' src='[picture:160*120]' />(#)#>摘要:[data:288]</div>
</h5><h6 class='post-footer'>分类:<a href='[categoryurl]'>[category]</a> | 浏览:[pv] | 评论:[commentnum]</h6></div>"}>
转载请注明:本文《ak_if的安全替代品ak_ifnotempty》链接: http://seo.leidu.net/post-328.html
百度已收录
发表评论: