当前位置:首页 >> 教程资讯 >> Pboot教程

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

录入编辑:微科技 | 发布时间:2023-01-04
在使用pbootcms模板建设网站过程中,如果列表使用了缩略图显示,后台即使没有上传缩略图也会显示默认图片。 如果我们不需要显示默认图片,在这时我们就可以用pbootcms自带的缩略图返回值来进行判断是否传了缩略图。 以下是判断有缩

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

以下是判断有缩略图才显示图片,没有上传也不显示默认图片的代码:

01{pboot:list scode={sort:scode}}
02<a href="[list:link]" rel="external nofollow"  title="[list:title]">
03<div class="flex-column">
04{pboot:if([list:isico]==1)}
05<img src="[list:ico]" alt="[list:title]">
06{/pboot:if}
07<div class="text-box">
08<h4>[list:title]</h4>
09<p class="intro hidden-sm">[list:content drophtml=1 dropblank=1 lencn=120]</p>
10<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>
11</div>
12</div>
13</a>
14{/pboot:list}
其中以下部分代码即为判断是否有图片的代码
isico可以取返回值1或者0即可判断是否有缩略图

需求代码如下

1{pboot:if(list:isico==1)}
2<img src="[list:ico]" alt="[list:title]">
3{/pboot:if}
如此判断后在没有传缩略图时就不会显示默认图片了

上一篇:pbootcms标签分页中url会无限重复叠加的解决方案
下一篇:pbootcms如何设置发布内容不自动提取缩略图
热门服务和内容

手机版

  • 官方微信

    扫码进入

  • 客服微信

  • 官方微信

    扫码添加

  • 高端网站设计,顶级互联网服务 Copyright © 2025 www.vikj.cn All Rights Reserved. 辽ICP备17005629号 XML地图 微科技
    电话咨询:0411-39550725
    在线客服咨询