本帖最后由 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
查找- while(($querysticky && $thread = $sdb->fetch_array($querysticky)) || ($query && $thread = $sdb->fetch_array($query))) {
复制代码 下面添加- $qu="SELECT t.attachment FROM {$tablepre}attachments t WHERE t.thumb = 1 AND t.tid=".$thread['tid']." ORDER BY t.aid ASC ";
- //echo $qu."<br>"; //$row = mysql_fetch_array($result)
- $query1 = mysql_fetch_array($db->query($qu));
- //echo $query1[0]."<br>";
- if($query1[0])
- $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>";
- else
- if(!$thread['hpic']){
- $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>";
- }
- 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
查找- <a href="forumdisplay.php?fid=$fid&filter=sort&sortid=$id$typeadd">$name</a>
- <!--{else}-->
- <strong>$name</strong>
- <!--{/if}-->
- </li>
- <!--{/loop}-->
- </ul>
- </div>
- <!--{/if}-->
- </p>
- <!--{/if}-->
- </div>
- <!--{/if}-->
复制代码 下面添加PS: {eval $hpicumns=4;} //4 表示横排的数量
{eval $incompact=array(15,38);} //15,38 表示板块的fid编号
3.再查找- <div class="pages_btns s_clear">
- $multipage
- <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>
- <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>
- </div>
复制代码 上面添加3.查找 /templates/你的模板目录/css_append.htm
在底部添加- #bb{ background-color: #EBF4FD;}
- #cc{ background-color: #ffffff;}
- #text-article img {border:0; margin:0; padding:0;max-width:215px;max-height:180px;_width:expression(this.width>215?"215px":this.width);
- _height:expression(this.height>180?"180px":this.height);}
复制代码 215是图片最宽,高度按比例自动缩小 (自行修改)
180是图片最高,宽度按比例自动缩小 (自行修改)
4.制作一个 nophoto.jpg 文件,放在论坛attahhments目录下 。 iconsmall.gif上传到images中自己的模板图片目录下 ,更新缓存!
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
几点说明:
1。本列表图片横排显示的是缩略图,后台必须打开缩略图功能。
2。建议后台取消全局置顶,否则占用大量版面,影响浏览!
3。列表管理不能,查找 /templates/你的模板目录/forumdisplay.htm
修改- <td align="center" valign="middle" class="icon">
复制代码 改为- <td align="center" valign="middle" class="icon" id="threadlist" style="position: relative;>
复制代码 4。显示帖子里缩略图,没缩略图直接显示原图(本人新手,这样写增加了近一倍的MYSQL查询次数,希望高手简化)
修改根目录 forumdisplay.php
将- $qu="SELECT t.attachment FROM {$tablepre}attachments t WHERE t.thumb = 1 AND t.tid=".$thread['tid']." ORDER BY t.aid ASC ";
- //echo $qu."<br>"; //$row = mysql_fetch_array($result)
- $query1 = mysql_fetch_array($db->query($qu));
- //echo $query1[0]."<br>";
- if($query1[0])
- $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>";
- else
- if(!$thread['hpic']){
- $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>";
- }
- else
复制代码 替换成- $qu="SELECT t.attachment FROM {$tablepre}attachments t WHERE t.thumb = 1 AND t.tid=".$thread['tid']." ORDER BY t.aid ASC ";
- //echo $qu."<br>"; //$row = mysql_fetch_array($result)
- $query1 = mysql_fetch_array($db->query($qu));
- //echo $query1[0]."<br>";
- $qu="SELECT t.attachment FROM {$tablepre}attachments t WHERE t.thumb = 0 AND t.tid=".$thread['tid']." ORDER BY t.aid ASC ";
- //echo $qu."<br>"; //$row = mysql_fetch_array($result)
- $query2 = mysql_fetch_array($db->query($qu));
- //echo $query2[0]."<br>";
- if($query1[0])
- $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>";
- else
- if($query2[0])
- $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>";
- else
- if(!$thread['hpic']){
- $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>";
- }
- else
复制代码 此方法用于没有生成缩略图的帖子图片,也就是比规定的生成范围还小的图片,显示代列表上 |