求老哥帮看一串PHP代码,万分感谢
discuz3.5的列表页显示的图片太多,加载速度太慢,所以想把显示的图片限制为一张,下面就是相关代码,求老哥告知该怎么改,只显示一张图片,万分感谢!
<!--{if $additional['attachment']}-->
<!--{eval $attach_on = 0;}-->
<a href="forum.php?mod=viewthread&tid=$thread['tid']" class="block-data-cover {if count($additional['attachment']) == 1}data-cover_1 {elseif count($additional['attachment']) == 2} data-cover_2{else} {/if}">
<!--{loop $additional['attachment'] $value}-->
<!--{eval $attach_on++; if($attach_on > 9) break;}-->
<div class="data-cover_item">
<img src="{TPLDIR}/assets/images/loading.gif" data-src="$value" class="lazy lazy-fade-in" alt="">
</div>
<!--{if count($additional['attachment']) > 9 && $attach_on == 9}-->
<div class="block-data-cover_count">共<span>{echo count($additional['attachment'])}</span>图</div>
<!--{/if}-->
<!--{/loop}-->
</a>
<!--{elseif $additional['media']}-->
{$additional['media']}
<!--{/if}-->
1 贡献最佳答案
"9"改成1
<!--{if $additional['attachment']}-->
<!--{eval $attach_on = 0;}-->
<a href="forum.php?mod=viewthread&tid=$thread['tid']" class="block-data-cover {if count($additional['attachment']) == 1}data-cover_1 {elseif count($additional['attachment']) == 2} data-cover_2{else} {/if}">
<!--{loop $additional['attachment'] $value}-->
<!--{eval $attach_on++; if($attach_on > 9) break;}-->
<div class="data-cover_item">
<img src="{TPLDIR}/assets/images/loading.gif" data-src="$value" class="lazy lazy-fade-in" alt="">
</div>
<!--{if count($additional['attachment']) > 9 && $attach_on == 9}-->
<div class="block-data-cover_count">共<span>{echo count($additional['attachment'])}</span>图</div>
<!--{/if}-->
<!--{/loop}-->
</a>
<!--{elseif $additional['media']}-->
{$additional['media']}
<!--{/if}-->
1 贡献最佳答案
"9"改成1
- 详细答案 >