插件作者的标准出来了!Manyou诚邀开发者加盟!
“互联网平台开发者”特刊 有奖征集开发者
立即免费下载 Discuz!6.1.0正式版
Discuz! 6.1.0 使用说明
Discuz!NT2.5正式版发布
开放源码下载
UCenter Home 1.2 正式版发布
官方站 | 帮助文档
基于ECShop的网店托管-卖否
PHP就业培训直通车 | LAMP培训大连
Discuz!收费服务内容及价格
“感谢有你同行”手握手2008年数万元重奖志愿者
Discuz!/ECShop 专用官方虚拟主机
亿声传媒(Insenz)中秋祝福发送中
Comsenz 招聘信息
网店系统ECShop v2.6.0正式版火热发布
基于Discuz!的免费论坛空间5D6D
参与有奖社区调查 赢取台湾5日游
发新话题
打印

[插件] 完美的首页4格_CACHE版 [附件图片+新帖+回复+精华+天气预报]FOR6.0_12月24日最后更新

完美的首页4格_CACHE版 [附件图片+新帖+回复+精华+天气预报]FOR6.0_12月24日最后更新

===================================================
插件名称:TOPLIST_首页四格_全CACHE版(GBK)
代码作者:oytktk (靖飒)     界面作者:9944
安装难度:易
插件功能:首页4格[随机调用附件图片+最新帖子+最新回复+精华帖子+天气预报]   
演示地址: http://www.liefeng.net

[attach]185039[/attach]


12月24日更新说明:1,修正本周热门的一些代码错误,加入实用的天气预报功能。2,修正无图版本周热门HTML代码过滤问题。

10月18日更新说明:美化界面,调整图片展示文字位置,天气预报加入时间显示,界面显示更协调,加入最新帖和精华帖的链接(直接使用官方代码)具体请看演示站。

9月30日更新说明:

根据网友jzzz 提醒,修正“无图版”的一些错误,并加入天气预报。

9月18日更新说明:
应网友rogerxu的要求,本人也需要,将最新回复中的链接改为指向最后回复的帖子。

9月17日更新说明:
应网友要求,将天气预报的插件补充发上了,可以完美配合这个首页4格。建议只在本插件上使用

说明:
1、由于页面调用使用了缓存,首页不增加查询,可极大的提高首页显示速度。CACHE版只在发帖时进行查询生成缓存,可降低服务器负担。非CACHE版每次打开首页都会进行一次查询。
2、新帖和回复数量特别大的站使用本插件会增加服务器负担。
3、增加收缩开关,收缩状时不读取缓存。
4、解决分辨率小时,版面换行问题。
5、直接使用官方CSS,读取更快,更完美的搭配官方6.0风格(自己添加的风格也可完美搭配)。
附件图片调用比较消耗资源,速度很慢的论坛建议使用无图版。
6、提问题的朋友请同时贴出网址,以便于查看问题。
7、版主TaRot! 对首页N格的问题已经整理成帖,有问题可先查看http://www.discuz.net/thread-655317-1-1.html
8、关于天气预报显示是北京的问题:由于这个插件并不能显示所以的地方的天气预报,所以对应IP段里没有地方就显示默认的北京。
9、由于代码编写的缺陷,请定时在后台更新缓存以更新精华帖。
10、没有修改过论坛文件的可直接下载附件覆盖即可。覆盖前请先打开后台管理界面,用二进制上传覆盖后直接在后台更新缓存即可。 安装成功后请跟帖。
11、如果discuz.htm已经修改过,上传时可以不上传discuz.htm文件,参照2楼的修改方法修改discuz.htm文件即可。

[ 本帖最后由 9944 于 2007-12-24 17:40 编辑 ]

附件

TOPLIS_CACHE_首页4格_FOR6.0懒人版.rar (86.56 KB)

2007-10-18 00:29, 下载次数: 3826

9月30日更新,加入天气预报和最后回复指向,美化界面。

TOPLIS_CACHE_首页4格_懒人版【最新主题+最新回复+本周热门(含天气预报)】.rar (78.18 KB)

2007-12-24 00:16, 下载次数: 1662

12月24日更新,修正一下错误,加入实用的天气预报。

TOPLIS_CACHE_首页4格_懒人版【最新主题+最新回复+本周热门(含天气预报)】.rar (78.18 KB)

2007-12-24 00:44, 下载次数: 1151

12月24日更新,无图版,极速显示。

TOPLIS_CACHE_首页4格_(0904)懒人版(含天气预报).rar (82.75 KB)

2007-9-17 20:54, 下载次数: 85 , 售价: 金币 10 个  [记录]  [购买]

第一附件已经包含有天气预报的内容。

本帖最近评分记录
  • goldfish5 金币 +1 安装成功,加分! 想问问如何把图片外的3 2007-10-22 11:08
  • dodo35 金币 +1 怎么把最新日志加进去呢,谢谢 2007-9-5 20:58
河池猎风户外运动俱乐部  http://www.liefeng.net

修改方法步骤:

更新至9月9日版。前面步骤一样, 省略步骤8,9。 更简洁,速度更快。


1。打开include/cache.func.php

查找
复制内容到剪贴板
代码:
'medals' => array('medals'),
如果搜不到,可搜索 array('medals'),  
的上面加
复制内容到剪贴板
代码:
'toplist'   => array('newthread', 'newreply','topdigest'),//TOPLIST_首页4格_全Cache版_代码by oytktk
继续查找:
复制内容到剪贴板
代码:
          case 'medals':
                        $table = 'medals';
                        $cols = 'medalid, name, image';
                        $conditions = "WHERE available='1'";
                        break;
上面加:
复制内容到剪贴板
代码:
        //TOPLIST_CACHE版
        case 'newthread':
            $table = 'threads t';
            $cols = 't.tid, t.fid, t.author, t.subject, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
            $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.displayorder!='-1' ORDER BY t.dateline DESC LIMIT 0, 8";
            break;

        case 'newreply':
            $table = 'threads t';
            $cols = 't.tid, t.fid, t.author, t.subject, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
            $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.replies>0 and t.displayorder!='-1'  ORDER BY t.lastpost DESC LIMIT 0, 8";
            break;
                        
        case 'topdigest':
             $table = 'threads t';
             $cols = 't.tid, t.fid, t.author, t.subject, t.digest, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
             $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE digest>0 ORDER BY rand() LIMIT 0, 8";
             break;
         //TOPLIST_CACHE版
----------------------------------
再找:
复制内容到剪贴板
代码:
case 'settings':
while($setting = $db->fetch_array($query))
上面加:
复制内容到剪贴板
代码:
//TOPLIST_CACHE版_代码by oytktk starts,improve(9944)

        case 'newthread':
            $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
            while($topthread = $db->fetch_array($query)) {
            $threadcolor = sprintf('%02d', $topthread['highlight']);
            $topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
            $topthread['subjectc'] = cutstr($topthread['subject'], 26);
            $topthread['threadcolor'] = $threadcolor[1] ? " style=\"color: ".$colorarray[$threadcolor[1]]."\"" : NULL;
            $topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $GLOBALS['timeoffset'] * 3600 );
            $topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $GLOBALS['timeoffset'] * 3600 );
            $topthread['name'] =  AddSlashes(strip_tags(trim($topthread['name'])));
            $data[] = $topthread;
                                }
            break;        
       case 'newreply':
            $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
                                while($topthread = $db->fetch_array($query)) {
            $threadcolor = sprintf('%02d', $topthread['highlight']);
            $topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
            $topthread['subjectc'] = cutstr($topthread['subject'], 26);
            $topthread['threadcolor'] = $threadcolor[1] ? " style=\"color: ".$colorarray[$threadcolor[1]]."\"" : NULL;
            $topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $GLOBALS['timeoffset'] * 3600 );
            $topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $GLOBALS['timeoffset'] * 3600 );
            $topthread['name'] =  AddSlashes(strip_tags(trim($topthread['name'])));
            $data[] = $topthread;
                                }
            break;
      
    case 'topdigest':
            $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
                  while($topthread = $db->fetch_array($query)) {
            $threadcolor = sprintf('%02d', $topthread['highlight']);
            $digest = array('1'=>'[Ⅰ]','2'=>'[Ⅱ]','3'=>'[Ⅲ]');
            $topthread['subjectc'] = $digest[$topthread['digest']]."-".cutstr($topthread['subject'], 23);
            $topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
            $topthread['threadcolor'] = $threadcolor[1] ? " style=\"color: ".$colorarray[$threadcolor[1]]."\"" : NULL;
            $topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $timeoffset * 3600);
            $topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $timeoffset * 3600);
            $topthread['name'] =  AddSlashes(strip_tags(trim($topthread['name'])));
            $data[] = $topthread;
             }
            break;

//TOPLIST_CACHE版
2。打开include/newthread.inc.php

查找:
复制内容到剪贴板
代码:
updatepostcredits('+', $discuz_uid, $postcredits);
下面加:
复制内容到剪贴板
代码:
require_once DISCUZ_ROOT.'./include/cache.func.php';
                updatecache('newthread');
3。打开 include/newreply.inc.php

查找:
复制内容到剪贴板
代码:
updatepostcredits('+', $discuz_uid, $replycredits);
下面加:
复制内容到剪贴板
代码:
require_once DISCUZ_ROOT.'./include/cache.func.php';
                updatecache('newreply');
4。打开 include/editpost.inc.php

查找:
复制内容到剪贴板
代码:
updatepostcredits('-', $orig['authorid'], ($isfirstpost ? $postcredits : $replycredits));
下面加:
复制内容到剪贴板
代码:
require_once DISCUZ_ROOT.'./include/cache.func.php';
                updatecache('newthread');
5。论坛根目录 index.php

查找:
复制内容到剪贴板
代码:
$threads = $posts = $todayposts = $fids = $announcepm = 0;
下面加
复制内容到剪贴板
代码:
//首页4格TOPLIST_CACHE版
if(!isset($_COOKIE['discuz_collapse']) || strpos($_COOKIE['discuz_collapse'], 'category_hk2 ') === FALSE) {
        $categorys_hk2 = 'collapsed_no.gif';
        $collapse['category_hk2'] = '';
        } else {
        $categorys_hk2 = 'collapsed_yes.gif';
        $collapse['category_hk2'] = 'display: none';
        }
        
if($categorys_hk2 == 'collapsed_no.gif'){
        require_once DISCUZ_ROOT.'./forumdata/cache/cache_toplist.php';
        $toplistloop = $_DCACHE['newthread'];
        }
//首页4格TOPLIST_CACHE版
6。 根目录 topicadmin.php

查找:
复制内容到剪贴板
代码:
showmessage((isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed'), $resultarray['redirect']);
上面加:
复制内容到剪贴板
代码:
require_once DISCUZ_ROOT.'./include/cache.func.php';
        updatecache('newthread');
7。templates\default\discuz.htm

查找:
复制内容到剪贴板
代码:
<!--{loop $catlist $key $cat}-->
        <!--{if $cat['forumscount']}-->
在上面添加:
复制内容到剪贴板
代码:
<!--{if empty($gid)}-->
        {template toplist}
<!--{/if}-->
8。
9。
10。上传附件1中的文件到网站根目录,后台更新缓存(不更新就不能打开首页)

结束!

[ 本帖最后由 9944 于 2007-9-9 12:17 编辑 ]

附件

toplist.rar (23.78 KB)

2007-9-9 11:53, 下载次数: 1019

河池猎风户外运动俱乐部  http://www.liefeng.net
谢谢咯!
如何只显示指定的版块:
复制内容到剪贴板
代码:
在cache.func.php 找到 $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.replies>0 and t.displayorder!='-1' (共3个) 后面加上AND f.fid IN (4,6,48,49,51,11,13) 括号里面的数字就是要显示的版块FID,改成你论坛版块的FID就可以了。
如何修改FLSAH图片的显示张数
复制内容到剪贴板
代码:
打开论坛根目录下的PIC.PHP 找到
//---设置---start
$shownums = 4;//FLSAH图片演示个数,不能超过6,否则无法使用导航条.
将4改成你想要的数字,但是不能超过6。
如何显示最新图片:
复制内容到剪贴板
代码:
在论坛根目录里的PIC.php 里查找 $orderby = 'rand'  然后将rand 改为 dateline 。更新缓存,OK。
如何显示FLASH时钟:
在templates/default/discuz.htm 里找到
复制内容到剪贴板
代码:
<!--{/if}-->
        


<!--{if empty($gid)}-->
        {template toplist}
在上面添加:
<td id="hottags" style="width:99px;"><object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="97" height="26" title="clock" align="absbottom">
        <param name="movie" value="../../images/clock.swf" />
        <param name="wmode" value="transparent" />
        <embed src="../../images/clock.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="97" height="34" align="bottom"></embed>
     </object><br />
     </td>
然后在后台开启奇虎搜索,一个漂亮的时钟就出现了。

如何设置截取标题的字数:
在cache.func.php 找到
case 'newthread':
            $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
            while($topthread = $db->fetch_array($query)) {
            $threadcolor = sprintf('%02d', $topthread['highlight']);
            $topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
            $topthread['subjectc'] = cutstr($topthread['subject'], 26);
     
红色的数字就是。修改成你想要的字数, 下面的case 'newreply':与case 'topdigest' 同样。


如何加入WWW.LIEFENG.NET里面的天气预报!
1,找到templates/default/toplist.htm 里的
复制内容到剪贴板
代码:
<h3>$sitename</h3>
在上面加上:
复制内容到剪贴板
代码:
<span class="headactions">{template weather}</span>
下载附件 上传 到 templates/default/  。。 OK.

如何将最新回复的链接指向最后回的帖?
在toplist.htm里找到最新回复里面href="viewthread.php?tid=$toploop[tid]  改成 href="redirect.php?tid=$toploop[tid]&goto=lastpost#lastpost

[ 本帖最后由 9944 于 2007-9-18 22:37 编辑 ]

附件

weather.rar (511 Bytes)

2007-9-17 14:36, 下载次数: 377

河池猎风户外运动俱乐部  http://www.liefeng.net
不错不错不错不错不错不错


http://www.feelroom.net
把精华帖子改成热门帖子:

打开include/cache.func.php

查找:
复制内容到剪贴板
代码:

        case 'topdigest':
             $table = 'threads t';
             $cols = 't.tid, t.fid, t.author, t.subject, t.digest, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
             $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE digest>0 ORDER BY rand() LIMIT 0, 8";
             break;
替换成:
复制内容到剪贴板
代码:

            case 'topviews':
            $table = 'threads t';
            $view = rand(1,3)==1 ? 'views' : 'replies';
            $cols = 't.tid, t.fid, t.author, t.subject, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
            $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.displayorder!='-1' ORDER BY t.$view DESC LIMIT 0, 8";
            break;
再找:
复制内容到剪贴板
代码:
case 'topdigest':
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
while($topthread = $db->fetch_array($query)) {
$threadcolor = sprintf('%02d', $topthread['highlight']);
$digest = array('1'=>'[Ⅰ]','2'=>'[Ⅱ]','3'=>'[Ⅲ]');
$topthread['subjectc'] = $digest[$topthread['digest']]."-".cutstr($topthread['subject'], 23);
$topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
$topthread['threadcolor'] = $threadcolor[1] ? " style=\"color: ".$colorarray[$threadcolor[1]]."\"" : NULL;
$topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $timeoffset * 3600);
$topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $timeoffset * 3600);
$topthread['name'] = AddSlashes(strip_tags(trim($topthread['name'])));
$data[] = $topthread;
}
break;
替换成:
复制内容到剪贴板
代码:

      case 'topviews':
            $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
                        while($topthread = $db->fetch_array($query)) {
            $threadcolor = sprintf('%02d', $topthread['highlight']);
            $topthread['subjectc'] = cutstr($topthread['subject'], 23);
            $topthread['threadcolor'] = $threadcolor[1] ? " style=\"color: ".$colorarray[$threadcolor[1]]."\"" : NULL;
            $topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
            $topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $timeoffset * 3600);
            $topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $timeoffset * 3600);
            $topthread['name'] =  AddSlashes(strip_tags(trim($topthread['name'])));
            $data[] = $topthread;
                        }
[ 本帖最后由 9944 于 2007-9-9 15:02 编辑 ]
河池猎风户外运动俱乐部  http://www.liefeng.net
顶啊啊```

嘿嘿``

给我一个姑娘,我可以创造一个民族。 VS   给我一部A片。我可以翘起一个地球
支持下~~
LuckyMay娱乐在线
http://www.luckymay.net
发新话题
版块跳转