Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

[疑问] 无图调用默认图片

[复制链接]
taiki99 发表于 2009-10-17 17:56:15 | 显示全部楼层 |阅读模式
本帖最后由 taiki99 于 2009-10-17 17:57 编辑

<!--{if $_SGET['page']<2 || empty($_SGET['mode'])}-->
<!--{block name="spacenews" parameter="perpage/16/catid/$thecat[subcatid]/showattach/1/order/i.dateline DESC/showspacename/1/showdetail/1/subjectlen/30/messagelen/100/cachename/newlist/tpl/data"}-->
<!--{if $_SBLOCK['newlist']}-->
<!--{loop $_SBLOCK['newlist'] $value}--><div class="row">
<!--{if !empty($value['a_thumbpath'])}--><a href="$value[url]"><img src="$value[a_thumbpath]" alt="$value[subject]"  width="98" height="98" /></a><!--{/if}-->
<h2><a href="$value[url]" target="_blank">$value[subject]</a></h2><p>$value[message]</p>
<strong><a href="$value[url]" target="_blank">浏览全文</a></strong></div><!--{/loop}--><!--{/if}--><!--{/if}--></div>
这是只能显示有图片的资讯代码.我想知道如何在内容页没有图片的时候显示指定图片?需要在上面代码中的那个位置加入判断有无图片,例如这个页面
http://www.febay.com.cn/fashion/Skin-makeup/

路径:
<a href="{S_URL}/"><img src="{S_URL}/templates/$_SCONFIG[template]/images/nopic.jpg" alt="“$_SCONFIG[sitename]”无图提示" border="0" /></a>
回复

使用道具 举报

麻吉求求 发表于 2009-10-17 18:02:25 | 显示全部楼层
本帖最后由 麻吉求求 于 2009-10-17 18:14 编辑

<!--{if $_SGET['page']<2 || empty($_SGET['mode'])}-->
<!--{block name="spacenews" parameter="perpage/16/catid/$thecat[subcatid]/order/i.dateline DESC/showspacename/1/showdetail/1/subjectlen/30/messagelen/100/cachename/newlist/tpl/data"}-->
<!--{if $_SBLOCK['newlist']}-->
<!--{loop $_SBLOCK['newlist'] $value}-->
<div class="row">
    <!--{if !empty($value['a_thumbpath'])}-->
    <a href="$value[url]"><img src="$value[a_thumbpath]" alt="$value[subject]"  width="98" height="98" /></a>
    <!--{/if}-->
    <h2><a href="$value[url]" target="_blank">$value[subject]</a></h2>
    <p>$value[message]</p>
    <strong><a href="$value[url]" target="_blank">浏览全文</a></strong>
</div>
<!--{/loop}-->
<!--{/if}-->
<!--{/if}-->
</div>

PS:看我签名!{:4_104:}
回复

使用道具 举报

 楼主| taiki99 发表于 2009-10-17 18:18:47 | 显示全部楼层
楼上的不能在有图片的时候显示原文图片,没图片的时候调用默认的.
加了一句js

    <!--{if !empty($value['a_thumbpath'])}-->
    <a href="$value[url]"><img src="$value[a_thumbpath]" alt="$value[subject]"  width="98" height="98" onerror="this.src='{S_URL}/templates/$_SCONFIG[template]/images/nopic.jpg'" /></a>
    <!--{/if}-->

不过启发了我,多谢了
回复

使用道具 举报

麻吉求求 发表于 2009-10-17 20:04:04 | 显示全部楼层
去掉,<!--{if !empty($value['a_thumbpath'])}-->和<!--{/if}-->
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-11-23 17:21 , Processed in 0.100349 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表