pbootcms模板文章列表没有缩略图时也不显示默认图片

2025-08-04 0 11

在使用pbootcms模板建设网站过程中,如果列表使用了缩略图显示,后台即使没有上传缩略图也会显示默认图片。
如果我们不需要显示默认图片,在这时我们就可以用pbootcms自带的缩略图返回值来进行判断是否传了缩略图。
以下是判断有缩略图才显示图片,没有上传也不显示默认图片的代码:

{pboot:list scode={sort:scode}}
<a href=”[list:link]” rel=”external nofollow”  title=”[list:title]”>
<div class=”flex-column”>
{pboot:if(‘[list:isico]’==’1’)}
<img src=”[list:ico]” alt=”[list:title]”>
{/pboot:if}
<div class=”text-box”>
<h4>[list:title]</h4>
<p class=”intro hidden-sm”>[list:content drophtml=1 dropblank=1 lencn=120]</p>
<p><span><i class=”fa fa-clock-o” aria-hidden=”true”></i> [list:date style=Y-m-d]</span><span><i class=”fa fa-eye” aria-hidden=”true”></i> list:visits 浏览</span><span><i class=”fa fa-thumbs-up” aria-hidden=”true”></i> list:likes 点赞</span></p>
</div>
</div>
</a>
{/pboot:list}

其中以下部分代码即为判断是否有图片的代码
isico可以取返回值1或者0即可判断是否有缩略图
需求代码如下

{pboot:if(‘list:isico’==’1’)}
<img src=”[list:ico]” alt=”[list:title]”>
{/pboot:if}

如此判断后在没有传缩略图时就不会显示默认图片了

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

版权声明:所有的源码、软件和资料,不得使用于非法商业用途,不得违反国家法律,一切关于该资源商业行为与本站无关。

免费cms模板 pbootcms教程 pbootcms模板文章列表没有缩略图时也不显示默认图片 https://www.mianfeicms.com/1401.html

相关文章

发表评论
暂无评论