如何在织梦列表页中先判断文章是否上传有缩略图,再根据判断结果来决定是否输出默认缩略图,这里用的是织梦的php扩展函数,具体代码如下: [field:array runphp=yes] @me=strpos(@me[picname
如何在织梦列表页中先判断文章是否上传有缩略图,再根据判断结果来决定是否输出默认缩略图,这里用的是织梦的php扩展函数,具体代码如下:
[field:array runphp='yes']
@me=strpos(@me['picname'],'defaultpic')?'':"<img src='@me[picname]'alt='[title]'/>";
[/field:array]
今天,小编遇到一个问题,想根据文章的附加属性来添加不同的样式。列出用flag函数来判断当前文章的属性做对应输出,代码为:
[field:flag runphp='yes']
if(stristr(@me,"c")) @me = "[^_^推荐]";
else if(stristr(@me,"a")) @me = "[^_^热门]";
else if(stristr(@me,"h")) @me = "[^_^头条]";
else @me = '';
[/field:flag]