Discuz教程网

【Discuz X1.5】列表缩略图(社区图库)插件

[复制链接]
authicon 小白 发表于 2011-2-20 21:32:46 | 显示全部楼层 |阅读模式
插件作者: love322093 站站鱼 无法下载,请举报
插件编码: GBK简体 
适用版本: Discuz! X1.5 
支持站点: http://woyoubanfa.com/dx15
作品介绍: 本插件对于图片社区来说应该算是非常不错的选择,一直觉得没有必要

为了图片展示安装N个文件的插件,认为这个是最简单直观的表达方式!特别说明,
本插件在love322093帮助下才得以完成,再次表示感谢



遇到问题请仔细检查是不是改的错误,版本对不对?语言对不对?请仔细检查代码
,实在弄不好,留下你设置的图片列表地址看看   我真的找不到问题出在哪?完全
正常  
从28号开始整理列表美化,结果才发现模板代码和原来变化也非常大,折腾了将近
10天,总算可以见人了,
肯定还有不少问题等待发现和处理,有兴趣的朋友可以先研究研究,

修改方法
第一步
----------------------------------------------------------------
在/source/module/forum/forum_forumdisplay.php
搜索
while(($querysticky && $thread = DB::fetch($querysticky)) || ($query &&
$thread = DB::fetch($query))) {
后面加//图片插件 作者:love322093 报以对原作者的感激之情,请保留本代码,
它不会影响您的任何界面,谢绝任何形式的改版!
$thread['aticon'] = DB::result_first("SELECT attachment FROM ".DB::table
('forum_attachment')." WHERE isimage = 1 AND tid=".$thread['tid']."");
$thread['thumb'] = DB::result_first("SELECT thumb FROM ".DB::table
('forum_attachment')." WHERE isimage = 1 AND tid=".$thread['tid']."");
if($thread['aticon'] && !$thread['thumb'] ){
require_once libfile('class/image');
$image = new image;
$r = $image->Thumb($_G['setting']['attachurl'].'forum/'.$thread
['aticon'], '', 200, 200, 2);//生成缩略图,400 宽 高是图片的大小.
if ($r) {
DB::update('forum_attachment', array('thumb' => 1), "isimage = 1 AND
tid=".$thread['tid']."");
} else {
$error = $image->error();
showmessage($error);
}
}
if($thread['thumb'] && $thread['aticon']!=null){
// $thread['aticon']=$_G['setting']['attachurl'].'forum/'.$thread
['aticon']."";
$thread['aticon']='<img src='.$_G['setting']
['attachurl'].'forum/'.$thread['aticon']."".'>';
}else{
$thread['aticon']="<img class='pic_li_img'
src='static/image/common/nopic.gif'>";
}
//echo $thread['aticon'];
//图片插件 作者:love322093 报以对原作者的感激之情,请保留本代码,它不会
影响您的任何界面,谢绝任何形式的改版!
第二步
在/template/default/forum/forumdisplay.htm
搜索
<!--{hook/forumdisplay_postbutton_top}-->

                        </div>

后面加
<!--{if (!$simplestyle || !$_G['forum']['allowside']) && !empty
($announcement)}-->
                        <div  
class="forumdisplay_announcement"style="margin-bottom: 10px;">
                                <tbody>
                                        <tr>
                                                <td class="icn"><img
src="{IMGDIR}/ann_icon.gif" alt="{lang announcement}" /></td>
                                                <!--{if $_G['forum']
['ismoderator'] && !$_G['gp_archiveid']}--><td class="o"> </td><!--{/if}
-->
                                                <th><strong
class="xst"><font style="font-size: 18px;font-family:'黑体'">{lang
announcement}: <!--{if empty($announcement['type'])}--><a
href="forum.php?mod=announcement&id=$announcement[id]#$announcement[id]"
target="_blank">$announcement[subject]</a><!--{else}--><a
href="$announcement[message]" target="_blank">$announcement[subject]
</a><!--{/if}--></font></strong></th>
                                                <td class="by">
                                                        <cite><a
href="home.php?mod=space&uid=$announcement[authorid]"
c="1">$announcement[author]</a></cite>

                                                </td>
                                                <td
class="num"><em>$announcement[starttime]</em></td>
                                        </tr>
                                </tbody>
                        </div>
                        <!--{/if}-->
第三部
在/template/default/forum/forumdisplay_list.htm
搜索   "forum.php?mod=topicadmin&action=moderate&fid=$_G[fid]
&infloat=yes&nopost=yes">
   <input type="hidden" name="formhash" value="{FORMHASH}" />
后面加<!--图片显示的模板+来自站站鱼+开始-->
   <!--{if in_array($_G['fid'], array(36,110))}-->
   <table summary="forum_$_G[fid]" {if !$separatepos}id="forum_$_G
[fid]"{/if} cellspacing="0" cellpadding="0">

<div class="show_topic_div" >
<ul class="show_topic_ul" >
<!--{if $_G['forum_threadcount']}-->
    <!--{loop $_G['forum_threadlist'] $key $thread}-->

    <!--{if $separatepos <= $key + 1}-->
     <!--{ad/threadlist}-->
    <!--{/if}-->
<li id="show_topic_li"class="off"
onMouseOver="this.className='on'"onmouseout="this.className='off'"
title="$thread[subject]">
<!--{if $thread['weeknew']}-->
<div style="margin-bottom:-36px;"><img src="{STATICURL}
image/filetype/new.gif" alt="查看新发型" /></div>
<!--{/if}-->

<!--{if $_G['uid']}-->
<a href='https://www.discuz.1314study.com/forum.php?mod=viewthread&tid=$thread[tid]'alt='$thread[subject]'
title='$thread[subject]'>$thread['aticon']</a>
<!--{/if}-->

<!--{if $gid || !$_G['uid']}-->
<a>$thread['aticon']</a>
<!--{/if}-->

<em style="float:left; display:block;width:200px;white-
space:nowrap;overflow:hidden;text-align: center;text-overflow:ellipsis;"
>
<!--{if $_G['uid']}-->
<dd style="float:left;width:200px;font-size: 14px;height:18px;margin-
top:3px;white-space:nowrap;overflow:hidden;text-align: center; text-
overflow:ellipsis;">
<a href="forum.php?mod=viewthread&tid=$thread[tid]&{if $_G
['gp_archiveid']}archiveid={$_G['gp_archiveid']}&{/if}
extra=$extra"$thread[highlight]{if $thread['isgroup'] == 1}
target="_blank"{/if} >$thread[subject]</a>
</dd>
<!--{/if}-->
<!--{if $gid || !$_G['uid']}-->
<dd style="float:left; display:block;width:200px;white-
space:nowrap;overflow:hidden;text-align: center; text-
overflow:ellipsis;">
<font color=#46A815>无权浏览高清图 请立即</font><a href="member.php?
mod=register" target="_blank"><b><font color=#FF6600>注册
</font></b></a><font color=#46A815>或</font><a href="member.php?
mod=logging&action=login" target="_blank"><b><font color=#FF6600>登录
</font></b></a></dd><br>
<!--{/if}-->
</em>
<dd style="float:left;width:188px;">
分享者:<a href="home.php?mod=space&uid=$thread[authorid]" c="1">$thread
[author]</a><br>
发布时间:{eval $days=date('Y-n-j',time());}
<!--{if $thread[dateline]==$days}-->
<font color="#0099FF">$thread[dateline]</font>
<!--{else}-->
$thread[dateline]
<!--{/if}--><br>
最后评论:<a href="{if $thread[digest] != -2}home.php?
mod=space&username=$thread[lastposterenc]{else}forum.php?
mod=viewthread&tid=$thread[tid]&page={echo max(1, $thread[pages]);}{/if}"
c="1">$thread[lastposter]</a>
<br>
关注:<font color=#009AFF>$thread[views]</font>  评论: <font
color=#17A801>$thread[replies]</font></dd> <br>

<!---------图标开始------------>
<em>
<!--{if !$_G['gp_archiveid'] && $_G['forum']['ismoderator']}-->

       <!--{if $thread['fid'] == $_G[fid]}-->
        <!--{if $thread['displayorder'] <= 3 || $_G['adminid'] == 1}-->
         <input type="checkbox" name="moderate
[]" value="$thread[tid]" />
        <!--{else}-->
         <input type="checkbox" disabled="disabled" />
        <!--{/if}-->
       <!--{else}-->
        <input type="checkbox" disabled="disabled" />
       <!--{/if}-->

      <!--{/if}-->

<!--{if $thread['readperm']}--> - [{lang readperm} <span
class="bold">$thread[readperm]</span>]<!--{/if}-->
       <!--{if $thread['price'] > 0}-->
        <!--{if $thread['special'] == '3'}-->
        - <span style="color: #C60">[{lang thread_reward}{$_G[setting]
[extcredits][$_G['setting']['creditstransextra'][2]][title]} <span
class="bold">$thread[price]</span> {$_G[setting][extcredits][$_G
['setting']['creditstransextra'][2]][unit]}]</span>
        <!--{else}-->
        - [{lang price} {$_G[setting][extcredits][$_G['setting']
['creditstransextra'][1]][title]} <span class="bold">$thread[price]
</span> {$_G[setting][extcredits][$_G['setting']['creditstransextra']
[1]][unit]}]
        <!--{/if}-->
       <!--{elseif $thread['special'] == '3' && $thread['price'] < 0}-->
        - [{lang reward_solved}]

       <!--{/if}-->
       <!--{if $thread['attachment'] == 2}-->
        <img src="{STATICURL}image/filetype/image_s.gif" alt="attach_img"
title="{lang attach_img}" align="absmiddle" />
       <!--{elseif $thread['attachment'] == 1}-->
        <img src="{STATICURL}image/filetype/common.gif" alt="attachment"
title="{lang attachment}" align="absmiddle" />
       <!--{/if}-->
       <!--{if $thread['displayorder'] == 0}-->
        <!--{if $thread[recommendicon] && $filter != 'recommend'}-->
         <img src="{IMGDIR}/recommend_$thread[recommendicon].gif"
align="absmiddle" alt="recommend" title="{lang thread_recommend} $thread
[recommends]" />
        <!--{/if}-->
        <!--{if $thread[heatlevel]}-->
         <img src="{IMGDIR}/hot_$thread[heatlevel].gif" align="absmiddle"
alt="heatlevel" title="$thread[heatlevel] {lang heats}" />
        <!--{/if}-->
        <!--{if $thread['digest'] > 0 && $filter != 'digest'}-->
         <img src="{IMGDIR}/digest_$thread[digest].gif" align="absmiddle"
alt="digest" title="{lang thread_digest} $thread[digest]" />
        <!--{/if}-->
        </em>
        <!--{if $thread['rate'] > 0}-->
         <div id="2" style="
float:right;margin-top:-70px;margin-right:-7px;" ><img
src="{IMGDIR}/wq.png" align="absmiddle" alt="agree" title="{lang
rate_credit_add}" /></div>
        <!--{elseif $thread['rate'] < 0}-->
         <img src="{IMGDIR}/disagree.gif" align="absmiddle"
alt="disagree" title="{lang posts_deducted}" />
        <!--{/if}-->
       <!--{/if}-->
       <!--{if $thread[multipage]}-->
        <span class="tps">$thread[multipage]</span>
</li>
                           <!--{/if}-->
<!-----图标结束-------->
<!--{/loop}-->
    </ul>
<!--{else}-->
</div>
   <!--{/if}-->
   </table>
<!--{/if}-->
<!--图片显示的模板+来自站站鱼+结束-->
<!--普通显示的模板+来自站站鱼+开始-->
<!--{if in_array($_G['fid'], array(2,100))}-->

搜索{else}5{/if}"><p class="emp">{lang forum_nothreads}
</p></th></tr></tbody>
                        <!--{/if}-->
                        </table>
后面加
   <!--{/if}-->
<!--普通显示的模板+来自站站鱼+结束-->

在common.css
最后面加
10月21日更新
#show_topic_li a img{ height:200px; width:200px; vertical-align: middle;
opacity: 0.40;/**Opera9.0+、Firefox1.5+、Safari、Chrom.兼容浏览器了**/
FILTER: alpha(opacity=40)"
onMouseOver="nereidFade(this,100,0,10)}
#show_topic_li a:hover img{ height:200px; width:200px; vertical-align:
middle; opacity: 0.9;/**Opera9.0+、Firefox1.5+、Safari、Chrom.兼容浏览器
了**/FILTER:}
.show_topic_li img { height:200px; width:200px; border: 1px solid
#FFFFFF;}

.off{overflow: hidden; background:#F9F9F9;}
.on{ overflow: hidden; background:#99C531;}
.show_topic_Newico { margin-bottom:-36px;}


于这两段代码需要特别说明,
无论自己修改还是覆盖这两段代码都要注意修改
第一段<!--{if in_array($_G['fid'], array(36,100))}-->
这里是希望那些版块显示图片数字可随意更改就是希望显示图片版块的ID!你也可
以添加(36,120,13,14,100)或删除
第二段<!--{if in_array($_G['fid'], array(2,110))}-->
这里版块普通显示,除图片显示以外的所有版块id数字!你也可以添加

覆盖版也需要小修改

这里只是展示代码原理
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<!--图片显示的模板+来自站站鱼+开始-->
<!--{if in_array($_G['fid'], array(36,37,38,39))}-->图片频道ID:我这里只
是举例子
<table width="200" border="1">
  <tr>
    <td>这里是图片显示 </td>
  </tr>
</table>
<!--{/if}-->
<!--图片显示的模板+来自站站鱼+结束-->
<!--普通显示的模板+来自站站鱼+开始-->
<!--{if in_array($_G['fid'], array(100,101,102,103))}-->普通显示版块ID:
<table width="200" border="1">
  <tr>
    <td>这里是普通显示 </td>
  </tr>
</table>
<!--{/if}-->
<!--普通显示的模板+来自站站鱼+结束-->
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

我建议您下载一个专门的Beyond Compare 2对比工具慢慢修改
wq.png
上传至/static/image/common/wq.png

new.gif
上传至/static/image/common/new.gif

nopic.gif
上传至/static/image/common/nopic.gif




上一篇:【Discuz X1.5】滑动快速返回顶部通用插件
下一篇:【Discuz X1.5】帖子背景插件
authicon 夕梨二世 发表于 2011-5-13 10:59:57 | 显示全部楼层
不错,我喜欢
authicon TRACYFLYING 发表于 2011-5-16 01:59:57 | 显示全部楼层
前来看看那
authicon nmzc 发表于 2011-5-18 09:59:49 | 显示全部楼层
好辛苦才找到啊
authicon hennly 发表于 2011-5-18 10:23:28 | 显示全部楼层
看不太懂。。我晕。
authicon rin421 发表于 2011-5-19 07:59:34 | 显示全部楼层
顶的就是你
authicon NicoleOnly 发表于 2011-5-23 17:59:35 | 显示全部楼层
万分感谢楼主
authicon huanglv80 发表于 2011-5-25 15:59:37 | 显示全部楼层
我回不回呢 考虑再三 还是不回了吧 ^_^
authicon 暗夜的烟火 发表于 2011-5-28 18:59:41 | 显示全部楼层
好辛苦才找到啊
authicon 婷婷爱牛牛 发表于 2011-6-21 06:00:28 | 显示全部楼层
这个不错呀
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-5-2 01:17

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

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