pbootcms列表页无缩略图也不显示默认图片方法

92建站   PbootCms   2022-12-29   收藏本文

本文介绍了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}

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

旺铺招租1 旺铺招租2 旺铺招租3 旺铺招租4 旺铺招租5 旺铺招租6
展开