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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[修改] 版块主题图片横排插件(支持宽屏) FOR 7.1 HACK IE FF

[复制链接]
108225693 发表于 2009-11-5 12:18:05 | 显示全部楼层 |阅读模式
插件发布
插件名称: 版块主题图片横排插件
插件来源:
适用版本: Discuz! 7.1
语言编码: GBK简体 UTF8简体 BIG5繁体 
最后更新时间:
插件作者: 108225693
插件简介: 版块主题图片横排显示,适合某板块全部为图片贴
本帖最后由 108225693 于 2009-11-15 13:11 编辑

演示页面:
http://bbs.hamanw.com/forum-38-1.html
http://bbs.hamanw.com/forum-15-1.html


根据 https://discuz.dismall.com/viewthread.php?tid=1475181 修改的



1.修改根目录 forumdisplay.php
查找
  1. while(($querysticky && $thread = $sdb->fetch_array($querysticky)) || ($query && $thread = $sdb->fetch_array($query))) {
复制代码
下面添加
  1. $qu="SELECT t.attachment FROM {$tablepre}attachments t WHERE t.thumb = 1 AND t.tid=".$thread['tid']." ORDER BY t.aid ASC  ";
  2.         //echo $qu."<br>";  //$row = mysql_fetch_array($result)
  3.         $query1 = mysql_fetch_array($db->query($qu));
  4.         //echo $query1[0]."<br>";
  5.         if($query1[0])
  6.                 $thread['hpic']="<a href='viewthread.php?tid=".$thread[tid]."&extra=".$extra."' onFocus='if(this.blur)this.blur()'><img border=0 src='attachments/".$query1[0].".thumb.jpg'></a>";
  7.          else      
  8.           if(!$thread['hpic']){
  9.                   $thread['hpic']="<a href='viewthread.php?tid=".$thread[tid]."&extra=".$extra."' onFocus='if(this.blur)this.blur()'><img border=0 src='attachments/nophoto.jpg'></a>";
  10. }
  11.         else
复制代码
PS:SELECT t.attachment FROM {$tablepre}attachments t WHERE t.thumb = 1
上面红色"thumb = 1"表示有缩略图才显示图片,没有显示默认图片(nophotos.jpg)。
改成"isimage = 1"表示7.1里使用的 图片 上传的图片
改成"isimage = -1"表示7.1里使用的 附件 上传的图片

2.查找 /templates/你的模板目录/forumdisplay.htm
查找
  1. <a href="forumdisplay.php?fid=$fid&filter=sort&sortid=$id$typeadd">$name</a>
  2.                                                 <!--{else}-->
  3.                                                         <strong>$name</strong>
  4.                                                 <!--{/if}-->
  5.                                                 </li>
  6.                                         <!--{/loop}-->
  7.                                         </ul>
  8.                                         </div>
  9.                                 <!--{/if}-->
  10.                         </p>
  11.                         <!--{/if}-->
  12.                 </div>
  13.                 <!--{/if}-->
复制代码
下面添加
  1. <!--版块主题图片横排插件-->
  2. {eval $hpicumns=4;}
  3. {eval $incompact=array(15,38);}

  4. <!--{if in_array($fid,$incompact)}-->
  5. <div style="position: relative;">
  6.         <form method="post" name="moderate" id="moderate" action="topicadmin.php?action=moderate&fid=$fid&infloat=yes&nopost=yes">
  7.           <input type="hidden" name="formhash" value="{FORMHASH}" />
  8.           <input type="hidden" name="listextra" value="$extra" />
  9.           <table width="100%" cellpadding="0" cellspacing="0" class="threadlist datalist" id="threadlist" >
  10.           <thead class="colplural">
  11.                                         <tr>
  12.                                                 <td colspan="2">&nbsp;<a href="javascript:;" id="filtertype" class="dropmenu" onclick="showMenu({'ctrlid':this.id});"><!--{if $filter == poll}-->{lang thread_poll}
  13.                                                         <!--{elseif $filter == trade}-->{lang thread_trade}
  14.                                                         <!--{elseif $filter == activity}-->{lang thread_activity}
  15.                                                         <!--{elseif $filter == debate}-->{lang thread_debate}
  16.                                                         <!--{elseif $filter == reward}-->{lang thread_reward}
  17.                                                         <!--{else}-->{lang type}<!--{/if}--></a></td>
  18.                                                 <!--{if $forum['ismoderator']}--><td class="icon">&nbsp;</td><!--{/if}-->
  19.                                                 <th>
  20.                                                         <ul class="itemfilter s_clear">
  21.                                                                 <li>{lang thread}:</li>
  22.                                                                 <li{if !$filter} class="current"{/if}><a href="forumdisplay.php?fid=$fid"><span>{lang all}</span></a></li>
  23.                                                                 <li{if $filter == 'digest'} class="current"{/if}><a class="filter" href="forumdisplay.php?fid=$fid&amp;filter=digest"><span>{lang digestposts}</span></a></li>
  24.                                                                 <!--{if $recommendthread[status]}--><li{if $filter == 'recommend'} class="current"{/if}><a class="filter" href="forumdisplay.php?fid={$fid}&filter=recommend&orderby=recommends"><span>{lang order_recommends}</span></a></li><!--{/if}-->
  25.                                                                 <li class="pipe">|</li>
  26.                                                                 <li>{lang dateline_range}:</li>
  27.                                                                 <li{if $filter == 86400} class="current"{/if}><a href="forumdisplay.php?fid=$fid&orderby=$orderby&filter=86400$typeadd$sortadd"><span>{lang last_1_days}</span></a></li>
  28.                                                                 <li{if $filter == 172800} class="current"{/if}><a href="forumdisplay.php?fid=$fid&orderby=$orderby&filter=172800$typeadd$sortadd"><span>{lang last_2_days}</span></a></li>
  29.                                                                 <li{if $filter == 604800} class="current"{/if}><a href="forumdisplay.php?fid=$fid&orderby=$orderby&filter=604800$typeadd$sortadd"><span>{lang last_7_days}</span></a></li>
  30.                                                                 <li{if $filter == 2592000} class="current"{/if}><a href="forumdisplay.php?fid=$fid&orderby=$orderby&filter=2592000$typeadd$sortadd"><span>{lang last_30_days}</span></a></li>
  31.                                                                 <li{if $filter == 7948800} class="current"{/if}><a href="forumdisplay.php?fid=$fid&orderby=$orderby&filter=7948800$typeadd$sortadd"><span>{lang last_90_days}</span></a></li>
  32.                                                                 <li class="pipe">|</li>
  33.                                                                 <li><a class="order {if $orderby == 'heats' || $orderby == 'recommends'}order_active{/if}" href="forumdisplay.php?fid={$fid}&filter=$filter&orderby={if $filter == 'recommend'}recommends{else}heats{/if}$typeadd$sortadd">{lang order_heats}</a></li>
  34.                                                         </ul>
  35.                                                 </th>
  36.                                                 <td class="author"><a href="forumdisplay.php?fid={$fid}&filter=$filter&orderby=dateline$typeadd$sortadd" class="order {if $orderby == 'dateline'}order_active{/if}">{lang author}/{lang time}</a></td>
  37.                                                 <td class="nums"><a href="forumdisplay.php?fid={$fid}&filter=$filter&orderby=replies$typeadd$sortadd" class="order {if $orderby == 'replies'}order_active{/if}">{lang replies}</a>&nbsp;<a href="forumdisplay.php?fid={$fid}&filter=$filter&orderby=views$typeadd$sortadd" class="order {if $orderby == 'views'}order_active{/if}">{lang views}</a></td>
  38.                                                 <td class="lastpost"><cite><a href="forumdisplay.php?fid={$fid}&filter=$filter&orderby=lastpost$typeadd$sortadd" class="order {if $orderby == 'lastpost'}order_active{/if}">{lang lastpost}</a></cite></td>
  39.                                         </tr>
  40.                   </thead>
  41.                         <thead><tr>
  42.                 </tr></thead>
  43.       </table>
  44.    
  45.    <!--{if $threadcount}-->
  46.       <div   style="width: {TABLEWIDTH}; border-top: none;border-bottom: none; border:0px">
  47.       <table width="100%" border="0" cellpadding="0" cellspacing="0" id="forum_$fid" summary="forum_$fid">
  48.     <tr>
  49.           <!--{loop $threadlist $key $thread}-->
  50.       <!--{if $key && ($key % $hpicumns == 0) }-->
  51.     </tr>
  52.    <!--{/if}-->
  53.    <td>
  54.          <div style="border: 1px solid #f1f1f1;margin-top: 10px;padding-left: 7px;" onmouseover="this.id='bb'" onmouseout="this.id='cc'"><table  width="225" border="0" cellpadding="0" cellspacing="0">
  55.         <tr><td width="225" height="200" align="center" valign="middle"><div id="text-article" style="border: 1px solid #EBF4FD;padding: 4px 0px 4px 0px;margin-top: 10px;">$thread['hpic']</div></td>
  56.                   </tr>
  57.         <tr><td>
  58.                   <table height="30" cellpadding="0" cellspacing="0" style="margin-left: 10px;margin-right: 10px;">
  59.             <tr><td height="35">
  60.                            <table height="30" cellpadding="0" cellspacing="0" padding="0">
  61.                 <tr>
  62. <td align="center" valign="middle" class="folder">
  63.                                                         <a href="viewthread.php?tid=$thread[tid]&amp;extra=$extra" title="{lang target_blank}" target="_blank">
  64.                                                         <!--{if $thread[folder] == 'lock'}-->
  65.                                                                 <img src="{IMGDIR}/folder_lock.gif" /></a>
  66.                                                         <!--{elseif in_array($thread['displayorder'], array(1, 2, 3))}-->
  67.                                                                 <img src="{IMGDIR}/pin_$thread[displayorder].gif" alt="$threadsticky[3-$thread[displayorder]]" /></a>
  68.                                                         <!--{else}-->
  69.                                                                 <img src="{IMGDIR}/folder_$thread[folder].gif" /></a>
  70.                                                         <!--{/if}-->                                                </td>
  71.                                                 <td class="icon">
  72.                                                 <!--{if $thread['special'] == 1}-->
  73.                                                         <a href="forumdisplay.php?fid=$fid&amp;filter=poll"><img src="{IMGDIR}/pollsmall.gif" alt="{lang thread_poll}" /></a>
  74.                                                 <!--{elseif $thread['special'] == 2}-->
  75.                                                         <a href="forumdisplay.php?fid=$fid&amp;filter=trade"><img src="{IMGDIR}/tradesmall.gif" alt="{lang thread_trade}" /></a>
  76.                                                 <!--{elseif $thread['special'] == 3}-->
  77.                                                         <a href="forumdisplay.php?fid=$fid&amp;filter=reward"><img src="{IMGDIR}/rewardsmall.gif" alt="{lang thread_reward}" <!--{if $thread['price'] < 0}-->class="solved"<!--{/if}--> /></a>
  78.                                                 <!--{elseif $thread['special'] == 4}-->
  79.                                                         <a href="forumdisplay.php?fid=$fid&amp;filter=activity"><img src="{IMGDIR}/activitysmall.gif" alt="{lang thread_activity}" /></a>
  80.                                                 <!--{elseif $thread['special'] == 5}-->
  81.                                                         <a href="forumdisplay.php?fid=$fid&amp;filter=debate"><img src="{IMGDIR}/debatesmall.gif" alt="{lang thread_debate}" /></a>
  82.                                                 <!--{else}-->
  83.                                                         $thread['icon']
  84.                                                 <!--{/if}-->                                                </td>
  85.                                                 <!--{if $forum['ismoderator']}-->
  86.                                                 <td align="center" valign="middle" class="icon"  id="threadlist" style="position: relative;>
  87.                                                         <!--{if $thread['fid'] == $fid && $thread['digest'] >= 0}-->
  88.                                                                 <input onclick="tmodclick(this)" class="checkbox" type="checkbox" name="moderate[]" value="$thread[tid]" />
  89.                                                         <!--{else}-->
  90.                                                                 <input class="checkbox" type="checkbox" disabled="disabled" />
  91.                                                         <!--{/if}-->                                                </td>
  92.                                                 <!--{/if}-->
  93.                                                 <th valign="middle" class="subject $thread[folder]">
  94.                                                         <!--{if $thread['attachment'] == 2}-->
  95.                                                                 <img src="images/attachicons/image_s.gif" alt="{lang attach_img}" class="attach" />
  96.                                                         <!--{elseif $thread['attachment'] == 1}-->
  97.                                                                 <img src="images/attachicons/common.gif" alt="{lang attachment}" class="attach" />
  98.                                                         <!--{/if}-->
  99.                                                         <!--{if $thread['displayorder'] == 0}-->
  100.                                                                 <!--{if $thread[recommendicon]}-->
  101.                                                                         <img src="{IMGDIR}/recommend_$thread[recommendicon].gif" class="attach" alt="{lang thread_recommend}" title="{lang thread_recommend}" />
  102.                                                                 <!--{/if}-->
  103.                                                                 <!--{if $thread[heatlevel]}-->
  104.                                                                         <img src="{IMGDIR}/hot_$thread[heatlevel].gif" class="attach" alt="$thread[heatlevel] {lang heats}" title="$thread[heatlevel] {lang heats}" />
  105.                                                                 <!--{/if}-->
  106.                                                                 <!--{if $thread['digest'] > 0}-->
  107.                                                                         <img src="{IMGDIR}/digest_$thread[digest].gif" class="attach" alt="{lang thread_digest} $thread[digest]" title="{lang thread_digest} $thread[digest]" />
  108.                                                                 <!--{/if}-->
  109.                                                                 <!--{if $thread['rate'] > 0}-->
  110.                                                                         <img src="{IMGDIR}/agree.gif" class="attach" alt="{lang rate_credit_add}" title="{lang rate_credit_add}" />
  111.                                                                 <!--{/if}-->
  112.                                                         <!--{/if}--></th>
  113.                 </tr></table>
  114.                          </td></tr>
  115.             <tr>
  116.               <td height="60" valign="top" class="subject $thread[folder]">
  117.                                                         <label>{$pluginhooks[forumdisplay_thread][$key]}&nbsp;</label>
  118.                                                         <!--{if $thread['moved']}-->
  119.                                                                 <!--{if $forum['ismoderator']}-->
  120.                                                                         <a href="topicadmin.php?action=moderate&optgroup=3&operation=delete&tid=$thread[moved]" onclick="showWindow('mods', this.href);return false">{lang thread_moved}:</a>
  121.                                                                 <!--{else}-->
  122.                                                                         {lang thread_moved}:
  123.                                                                 <!--{/if}-->
  124.                                                         <!--{/if}-->
  125.                                                         $thread[sortid] $thread[typeid]
  126.                                                         <span id="thread_$thread[tid]"><a href="viewthread.php?tid=$thread[tid]&amp;extra=$extra"$thread[highlight]>$thread[subject]</a></span>
  127.                                                         <!--{if $thread['readperm']}--> - [{lang readperm} <span class="bold">$thread[readperm]</span>]<!--{/if}-->
  128.                                                         <!--{if $thread['price'] > 0}-->
  129.                                                                 <!--{if $thread['special'] == '3'}-->
  130.                                                                 - <span style="color: #C60">[{lang thread_reward}{$extcredits[$creditstransextra[2]][title]} <span class="bold">$thread[price]</span> {$extcredits[$creditstransextra[2]][unit]}]</span>
  131.                                                                 <!--{else}-->
  132.                                                                 - [{lang price} {$extcredits[$creditstransextra[1]][title]} <span class="bold">$thread[price]</span> {$extcredits[$creditstransextra[1]][unit]}]
  133.                                                                 <!--{/if}-->
  134.                                                         <!--{elseif $thread['special'] == '3' && $thread['price'] < 0}-->
  135.                                                                 - <span style="color: #269F11">[{lang reward_solved}]</span>
  136.                                                         <!--{/if}-->
  137.                                                         <!--{if $thread[multipage]}-->
  138.                                                                 <span class="threadpages">$thread[multipage]</span>
  139.                                                   <!--{/if}-->                                                </td>
  140.             </tr>
  141.             <tr><td>{lang author}:
  142.                           <!--{if $thread['authorid'] && $thread['author']}-->
  143.                             <a href="viewpro.php?uid=$thread[authorid]"> $thread[author]</a>
  144.                       <!--{else}-->
  145.                             <!--{if $forum['ismoderator']}-->
  146.                                      <a href="viewpro.php?uid=$thread[authorid]">{lang anonymous}</a>
  147.                             <!--{else}-->
  148.                                     {lang anonymous}
  149.                             <!--{/if}-->
  150.                       <!--{/if}-->                          
  151.                       </td></tr>
  152.             <tr><td>{lang replies}: $thread[replies] / {lang views}:<span class="lighttxt">$thread[views]</span></td></tr>
  153.           </table></td></tr>
  154.       </table></div></td>
  155. <!--{/loop}-->
  156. </table></div>

  157.     <!--{else}-->
  158.        <tbody><tr><td colspan="6">{lang forum_nothreads}</td></tr></tbody>
  159.     <!--{/if}-->
  160.     <!--{if $forum['ismoderator'] && $threadcount}-->
  161.            {template topicadmin_modlayer}
  162.     <!--{/if}-->
  163. </form>
  164. </div>        
  165. <!--{else}-->
  166. <!--版块主题图片横排插件-->
复制代码
PS:    {eval $hpicumns=4;}           //4 表示横排的数量
         {eval $incompact=array(15,38);}           //15,38 表示板块的fid编号
3.再查找
  1. <div class="pages_btns s_clear">
  2.                         $multipage
  3.                         <span <!--{if $visitedforums}-->id="visitedforums" onmouseover="$('visitedforums').id = 'visitedforumstmp';this.id = 'visitedforums';showMenu(this.id)"<!--{/if}--> class="pageback"><a href="$indexname">{lang return_index}</a></span>
  4.                         <span class="postbtn" id="newspecialtmp" onmouseover="$('newspecial').id = 'newspecialtmp';this.id = 'newspecial';showMenu(this.id)"><a href="post.php?action=newthread&fid=$fid" onclick="floatwin('open_newthread', this.href, 600, 410, '600,0');return false;">{lang send_posts}</a></span>
  5.                 </div>
复制代码
上面添加
  1. <!--{/if}-->
复制代码
3.查找 /templates/你的模板目录/css_append.htm
在底部添加
  1. #bb{ background-color: #EBF4FD;}
  2. #cc{ background-color: #ffffff;}

  3. #text-article img {border:0; margin:0; padding:0;max-width:215px;max-height:180px;_width:expression(this.width>215?"215px":this.width);
  4. _height:expression(this.height>180?"180px":this.height);}
复制代码
215是图片最宽,高度按比例自动缩小 (自行修改)
180是图片最高,宽度按比例自动缩小 (自行修改)

4.制作一个 nophoto.jpg 文件,放在论坛attahhments目录下  。 iconsmall.gif上传到images中自己的模板图片目录下 ,更新缓存!


////////////////////////////////////////////////////////////////////////////////////






































////////////////////////////////////////////////////////////////////////////////////
几点说明:
1。本列表图片横排显示的是缩略图,后台必须打开缩略图功能。
2。建议后台取消全局置顶,否则占用大量版面,影响浏览!
3。列表管理不能,查找 /templates/你的模板目录/forumdisplay.htm
修改
  1. <td align="center" valign="middle" class="icon">
复制代码
改为
  1. <td align="center" valign="middle" class="icon"  id="threadlist" style="position: relative;>
复制代码
4。显示帖子里缩略图,没缩略图直接显示原图(本人新手,这样写增加了近一倍的MYSQL查询次数,希望高手简化)
修改根目录 forumdisplay.php
  1. $qu="SELECT t.attachment FROM {$tablepre}attachments t WHERE t.thumb = 1 AND t.tid=".$thread['tid']." ORDER BY t.aid ASC  ";
  2.         //echo $qu."<br>";  //$row = mysql_fetch_array($result)
  3.         $query1 = mysql_fetch_array($db->query($qu));
  4.         //echo $query1[0]."<br>";
  5.         if($query1[0])
  6.                 $thread['hpic']="<a href='viewthread.php?tid=".$thread[tid]."&extra=".$extra."' onFocus='if(this.blur)this.blur()'><img border=0 src='attachments/".$query1[0].".thumb.jpg'></a>";
  7.          else      
  8.           if(!$thread['hpic']){
  9.                   $thread['hpic']="<a href='viewthread.php?tid=".$thread[tid]."&extra=".$extra."' onFocus='if(this.blur)this.blur()'><img border=0 src='attachments/nophoto.jpg'></a>";
  10. }
  11.         else
复制代码
替换成
  1. $qu="SELECT t.attachment FROM {$tablepre}attachments t WHERE t.thumb = 1 AND t.tid=".$thread['tid']." ORDER BY t.aid ASC ";
  2.         //echo $qu."<br>";  //$row = mysql_fetch_array($result)
  3.         $query1 = mysql_fetch_array($db->query($qu));
  4.         //echo $query1[0]."<br>";

  5. $qu="SELECT t.attachment FROM {$tablepre}attachments t WHERE t.thumb = 0 AND t.tid=".$thread['tid']." ORDER BY t.aid ASC ";
  6.         //echo $qu."<br>";  //$row = mysql_fetch_array($result)
  7.         $query2 = mysql_fetch_array($db->query($qu));
  8.         //echo $query2[0]."<br>";

  9.         if($query1[0])
  10.                 $thread['hpic']="<a href='viewthread.php?tid=".$thread[tid]."&extra=".$extra."' onFocus='if(this.blur)this.blur()'><img border=0 src='attachments/".$query1[0].".thumb.jpg'></a>";
  11.         else      
  12.         if($query2[0])
  13.                 $thread['hpic']="<a href='viewthread.php?tid=".$thread[tid]."&extra=".$extra."' onFocus='if(this.blur)this.blur()'><img border=0 src='attachments/".$query2[0]."'></a>";
  14.         else
  15.         if(!$thread['hpic']){
  16.                 $thread['hpic']="<a href='viewthread.php?tid=".$thread[tid]."&extra=".$extra."' onFocus='if(this.blur)this.blur()'><img border=0 src='attachments/nophoto.jpg'></a>";
  17. }
  18.         else
复制代码
此方法用于没有生成缩略图的帖子图片,也就是比规定的生成范围还小的图片,显示代列表上

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
liktmart 发表于 2009-11-5 13:04:18 | 显示全部楼层
非常卡的说。
回复

使用道具 举报

 楼主| 108225693 发表于 2009-11-5 14:58:43 | 显示全部楼层
400条数据,服务器没占多少资源
不过客户端的配置差点可能会卡一会,不过一次读取完了,后面就不读数据了
回复

使用道具 举报

zyhoo 发表于 2009-11-5 15:01:32 | 显示全部楼层
卡死 没法看
回复

使用道具 举报

 楼主| 108225693 发表于 2009-11-10 12:03:51 | 显示全部楼层
优化了下可以了
回复

使用道具 举报

11107207 发表于 2009-11-10 12:40:36 | 显示全部楼层
支持楼主,谢谢共享
回复

使用道具 举报

taoyuan_zy 发表于 2009-11-11 15:48:15 | 显示全部楼层
用不了。上了又下来了
回复

使用道具 举报

inaday 发表于 2009-11-12 01:01:37 | 显示全部楼层
http://www.pode.cn/fashion-0-1.html

lz 看下这个修改的,很喜欢。用lz的方法,我的站有些不美观
现在我研究,技术有限,修改的版式很乱,十分郁闷~

希望lz能看下上面的,修改修改~   有顶的功能就再好不过了
回复

使用道具 举报

windfy 发表于 2009-11-12 17:53:40 | 显示全部楼层
收藏,以后可能会用上。
回复

使用道具 举报

ireneluoyumin 发表于 2009-11-14 00:44:04 | 显示全部楼层
帖子页面也变成缩略图了~~郁闷~~
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-18 13:58 , Processed in 0.140696 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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