標題: [D4.0 & 4.1] 新首頁四格,加後台控制,其中一格圖片幻燈片
 ufoufoufo
 0003296
Rank: 1
點擊查看 ufoufoufo 的詳細資料

頭銜: Newbie

帖子: 22

精華: 0

積分: 320 點

現金: 100 元

存款: 4 元

閱讀權限: 10

註冊: 2004-6-23

來自: hk

狀態: 離線
 
發表於 2006-8-14 18:26  資料  個人空間  主頁 短消息  加為好友 
新首頁四格,加後台控制,其中一格圖片幻燈片

[box=#6666FF]首頁四格,加後台控制,其中一格圖片幻燈片 [/box]
預覽地址: http://ufojats.5166.info/
或見附件:
插件說明:
1、增加最近比較熱門的圖片預覽功能;
2、其他三格為:最新發表帖子,最新回復帖子,最熱門帖子;
3、有升級數據庫。
開始安裝:
1、後台升級數據庫
INSERT INTO `cdb_settings` VALUES ('show_toplist', '1');

2、編輯文件admin/setting.inc.php(後台顯示功能設置內添加開關)
查找:
showsetting('settings_nocacheheaders', 'settingsnew[nocacheheaders]', $settings['nocacheheaders'], 'radio');

下面添加:
showsetting('settings_show_toplist', 'settingsnew[show_toplist]', $settings['show_toplist'], 'radio');

3、編輯語言包templates/default/admincp.lang.php(後台管理頁面顯示的文字)
查找:
'settings_forumjump_comment' => '選擇「是」將在列表頁面下部顯示快捷跳轉菜單。注意: 當分論壇很多時,本功能會嚴重加重服務器負擔',

下面添加:
'settings_show_toplist' => '顯示首頁四格',
'settings_show_toplist_comment' => '選則「是」將在首頁顯示首頁四格',

4、 include/cache.func.php
查找
'medals'        => array('medals')

上面加
'toplist'        => array('newthread', 'newreply', 'topdigest', 'topviews'),//TOPLIST_首頁四格_全Cache版_By oytktk

繼續查找
case 'medals':
                        $table = 'medals';
                        $cols = 'medalid, name, image';
                        $conditions = "WHERE available='1'";
                        break;

上面加
  
//首頁四格TOPLIST_CACHE版, By oytktk 代碼首
                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, 10";
                        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, 10";
                        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, 10";
                        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, 10";
                        break;

                //首頁四格TOPLIST_CACHE版, By oytktk 代碼尾

再找:
case 'settings':
                        $data['qihoo_links'] = array();
                        while($setting = $db->fetch_array($query))

上面加

//首頁四格TOPLIST_CACHE版, By oytktk 代碼首

                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'], 28);
                                $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 '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'] + $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 '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'], 32);
                                $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;
                        }
                        break;


                //首頁四格TOPLIST_CACHE版, By oytktk 代碼尾

5、 include/newthread.inc.php
查找
updatepostcredits('+', $discuz_uid, $postcredits);

下面加
require_once DISCUZ_ROOT.'./include/cache.func.php';
                updatecache('newthread');

6、 include/newreply.inc.php
查找
updatepostcredits('+', $discuz_uid, $replycredits);

下面加
  
require_once DISCUZ_ROOT.'./include/cache.func.php';
                updatecache('newthread');

7、include/editpost.inc.php
查找
updatepostcredits('-', $orig['authorid'], ($isfirstpost ? $postcredits : $replycredits));

下面加
   require_once DISCUZ_ROOT.'./include/cache.func.php';
                updatecache('newthread');

8、index.php
查找
$forumlist = $catforumlist = $forums = $catforums = $categories = $collapse = array();

下面加
//首頁四格TOPLIST_CACHE版, By oytktk 代碼首
        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'];
        }
        //首頁四格TOPLIST_CACHE版, By oytktk 代碼尾

9、topicadmin.php
查找
showmessage((isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed'),

上面加
  
require_once DISCUZ_ROOT.'./include/cache.func.php';
        updatecache('newthread');

10、templates/default/index.htm
查找
<!--{if !empty($advlist['text'])}--><div class="maintable"><table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="{TABLEWIDTH}" align="center" class="tableborder">$advlist[text]</table><br></div><!--{/if}-->

在下面加
<!--{if empty($gid)}-->
<!--{if $show_toplist}-->
<div class="maintable">
{template toplist}
<br>
</div>
<!--{/if}-->
<!--{/if}-->


11、下載附件toplist.rar上傳至相應的目錄內即可!其中topview文件夾上傳至論壇跟目錄,toplist.htm文件上傳至templates/default

12、到後台更新緩存(務必!!!)

其他需要自己再做些修改,自己設置吧!!

注意:預覽的圖片經本人只測試了支持.jpg格式,不支持.gif格式!

13、一些供選擇的小修改:
1、需要縮放按鈕的朋友修改以下地方:
在toplist.htm裡面查找
<td colspan="4" align="center" class="header">

後面加
<p align="left"><a href="index.php" onclick="toggle_collapse

('category_hk2');"><img id="category_hk2_img" src="{IMGDIR}/$categorys_hk2" align="right" border="0"></a>

2、如果想每個格子裡面顯示的條數為自己設定值得話,請修改如下地方:(前提是步驟12以前都已經完成)
打開include/cache.func.php
查找
$conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.displayorder!='-1' ORDER BY t.dateline DESC LIMIT 0, 10";

$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, 10";

$conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE digest>0 ORDER BY rand() LIMIT 0, 10";

$conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.displayorder!='-1' ORDER BY t.$view DESC LIMIT 0, 10";


替換成你想要數字(即顯示的條數)。

如果不想顯示某個子板塊的帖子:
可以在
cache.func.php裡面把新加入的那段代碼中4個ORDER BY前全部加上and f.fid!=''(引號裡是隱藏帖子所在論壇的fid號,例如:and f.fid!='3')更新緩存就行了.
他人提供,本人己作測試,自己試試看吧!!!

附件在"5"樓

[ 本帖最後由 ufoufoufo 於 2007-3-28 06:23 編輯 ]



 附件: 您所在的用戶組無法下載或查看附件



 AL8 Forum © All rights reserved.
頂部
 小智仔
 0040753
Rank: 3Rank: 3Rank: 3
點擊查看 小智仔 的詳細資料

頭銜: Conqueror

帖子: 210

精華: 0

積分: 2340 點

現金: 26 元

存款: 1 元

閱讀權限: 20

註冊: 2006-2-28

狀態: 離線
 
發表於 2006-8-14 18:30  資料  個人空間  短消息  加為好友 
給你頂頂帖




 AL8 Forum © All rights reserved.
頂部
 小智仔
 0040753
Rank: 3Rank: 3Rank: 3
點擊查看 小智仔 的詳細資料

頭銜: Conqueror

帖子: 210

精華: 0

積分: 2340 點

現金: 26 元

存款: 1 元

閱讀權限: 20

註冊: 2006-2-28

狀態: 離線
 
發表於 2006-8-14 18:32  資料  個人空間  短消息  加為好友 
老哥

你係咪漏左1個無CODE到




 AL8 Forum © All rights reserved.
頂部
 ufoufoufo
 0003296
Rank: 1
點擊查看 ufoufoufo 的詳細資料

頭銜: Newbie

帖子: 22

精華: 0

積分: 320 點

現金: 100 元

存款: 4 元

閱讀權限: 10

註冊: 2004-6-23

來自: hk

狀態: 離線
 
發表於 2006-8-14 18:48  資料  個人空間  主頁 短消息  加為好友 
(to第 3 帖)漏左個個我己經加左上去啦,唔該你提醒喎




 AL8 Forum © All rights reserved.
頂部
 ufoufoufo
 0003296
Rank: 1
點擊查看 ufoufoufo 的詳細資料

頭銜: Newbie

帖子: 22

精華: 0

積分: 320 點

現金: 100 元

存款: 4 元

閱讀權限: 10

註冊: 2004-6-23

來自: hk

狀態: 離線
 
發表於 2006-8-14 19:11  資料  個人空間  主頁 短消息  加為好友 
因發貼時粗心漏了發附件,完成以上操作後請下載這個附件!

[ 本帖最後由 ufoufoufo 於 2006-8-14 19:12 編輯 ]



 附件: 您所在的用戶組無法下載或查看附件



 AL8 Forum © All rights reserved.
頂部
 Fiona
 0045153
Rank: 5Rank: 5Rank: 5Rank: 5Rank: 5

頭銜: King

帖子: 865

精華: 0

積分: 11360 點

現金: 884 元

存款: 0 元

閱讀權限: 30

註冊: 2006-5-17

狀態: 離線
 
發表於 2006-8-14 19:24  資料  個人空間  短消息  加為好友 
請問呢個四格有冇得set唔顯示某d區




 AL8 Forum © All rights reserved.
頂部
 ufoufoufo
 0003296
Rank: 1
點擊查看 ufoufoufo 的詳細資料

頭銜: Newbie

帖子: 22

精華: 0

積分: 320 點

現金: 100 元

存款: 4 元

閱讀權限: 10

註冊: 2004-6-23

來自: hk

狀態: 離線
 
發表於 2006-8-14 19:43  資料  個人空間  主頁 短消息  加為好友 
回覆第 6 帖由 Fiona 所發的帖子

當然有啦請詳細看一次安裝方法我引用其中幾句:
QUOTE:
如果不想顯示某個子板塊的帖子:
可以在cache.func.php裡面把新加入的那段代碼中4個ORDER BY前全部加上and f.fid!=''(引號裡是隱藏帖子所在論壇的fid號,例如:and f.fid!='3')更新緩存就行了.
他人提供,本人己作測試,自己試試看吧!!!




 AL8 Forum © All rights reserved.
頂部
 nasor
 0048715
Rank: 1

頭銜: Newbie

帖子: 23

精華: 0

積分: 310 點

現金: 63 元

存款: 0 元

閱讀權限: 10

註冊: 2006-7-26

狀態: 離線
 
發表於 2006-8-16 02:19  資料  個人空間  短消息  加為好友 
首先多謝ufoufoufo呢個插件, 但安裝之後出現了問題.

一load首頁就出現下面error message.

Warning: main....../bbs/./forumdata/cache/cache_toplist.php): failed to open stream: No such file or directory in ....../bbs/index.php on line 76

我想是找不到cache_toplist.php這個檔案, 這個file是怎樣才會出現呢? 是我做漏了什麼嗎?




 AL8 Forum © All rights reserved.
頂部
 ufoufoufo
 0003296
Rank: 1
點擊查看 ufoufoufo 的詳細資料

頭銜: Newbie

帖子: 22

精華: 0

積分: 320 點

現金: 100 元

存款: 4 元

閱讀權限: 10

註冊: 2004-6-23

來自: hk

狀態: 離線
 
發表於 2006-8-16 02:40  資料  個人空間  主頁 短消息  加為好友 
回覆第 8 帖由 nasor 所發的帖子

這個檔案是在第一步
升級數據庫時自動生成的
QUOTE:
1、後台升級數據庫
INSERT INTO `cdb_settings` VALUES ('show_toplist', '1');

請問閣下有無做這個動作呢?
如果做了也有問題的話我送一個上
cache_toplist.php上黎睇下有冇用佢放在
\forumdata\cache里面

[ 本帖最後由 ufoufoufo 於 2006-8-16 02:45 編輯 ]



 附件: 您所在的用戶組無法下載或查看附件



 AL8 Forum © All rights reserved.
頂部
 天福
 0032936
Rank: 4Rank: 4Rank: 4Rank: 4

頭銜: Lord

帖子: 587

精華: 0

積分: 8748 點

現金: 33 元

存款: 0 元

閱讀權限: 25

註冊: 2005-10-16

狀態: 離線
 
發表於 2006-8-16 03:09  資料  個人空間  短消息  加為好友 
如果安裝了AL8 首頁四格顯示,那點辦??




 AL8 Forum © All rights reserved.
頂部
 nasor
 0048715
Rank: 1

頭銜: Newbie

帖子: 23

精華: 0

積分: 310 點

現金: 63 元

存款: 0 元

閱讀權限: 10

註冊: 2006-7-26

狀態: 離線
 
發表於 2006-8-16 03:34  資料  個人空間  短消息  加為好友 
QUOTE:
原帖由 ufoufoufo 於 2006-8-16 02:40 發表。&nbsp;
這個檔案是在第一步
升級數據庫時自動生成的
請問閣下有無做這個動作呢?
如果做了也有問題的話我送一個上
cache_toplist.php上黎睇下有冇用佢放在
\forumdata\cache里面

好多謝你咁快回覆, 亦多謝你個檔案.

我肯定之前我已做升級數據庫, 只是記得做得時候要再輸入密碼然後我再升級一次~

現在我做了, 不過出現咁既情況呢, 那個是亂碼之外更不是我最新的回覆~


多謝你既幫忙!




 AL8 Forum © All rights reserved.
頂部
 nasor
 0048715
Rank: 1

頭銜: Newbie

帖子: 23

精華: 0

積分: 310 點

現金: 63 元

存款: 0 元

閱讀權限: 10

註冊: 2006-7-26

狀態: 離線
 
發表於 2006-8-16 04:12  資料  個人空間  短消息  加為好友 
ufoufoufo兄, 問題解決了, 可以是CHMOD問題, 謝謝!




 AL8 Forum © All rights reserved.
頂部
 nasor
 0048715
Rank: 1

頭銜: Newbie

帖子: 23

精華: 0

積分: 310 點

現金: 63 元

存款: 0 元

閱讀權限: 10

註冊: 2006-7-26

狀態: 離線
 
發表於 2006-8-16 04:56  資料  個人空間  短消息  加為好友 
如果要隱藏"論壇最熱的貼子"可以怎做呢?

又或者將"論壇最熱的貼子"變成"隨機貼子", 又可不可以呢? 先謝!




 AL8 Forum © All rights reserved.
頂部
 ufoufoufo
 0003296
Rank: 1
點擊查看 ufoufoufo 的詳細資料

頭銜: Newbie

帖子: 22

精華: 0

積分: 320 點

現金: 100 元

存款: 4 元

閱讀權限: 10

註冊: 2004-6-23

來自: hk

狀態: 離線
 
發表於 2006-8-16 11:17  資料  個人空間  主頁 短消息  加為好友 
回覆第 13 帖由 nasor 所發的帖子

因為我的檔案用的UTF8編碼而你的不是所以有亂碼,你只要將它重新轉成big5碼
問題應會解決




 AL8 Forum © All rights reserved.
頂部
 Jay.W
 0049861
Rank: 3Rank: 3Rank: 3

頭銜: Conqueror

帖子: 105

精華: 0

積分: 600 點

現金: 256 元

存款: 0 元

閱讀權限: 20

註冊: 2006-8-14

狀態: 離線
 
發表於 2006-8-16 11:34  資料  個人空間  主頁 短消息  加為好友  添加 Jay.W 為MSN好友 通過MSN和 Jay.W 交談
好東西!!
簡潔有力




 AL8 Forum © All rights reserved.
頂部
 Jay.W
 0049861
Rank: 3Rank: 3Rank: 3

頭銜: Conqueror

帖子: 105

精華: 0

積分: 600 點

現金: 256 元

存款: 0 元

閱讀權限: 20

註冊: 2006-8-14

狀態: 離線
 
發表於 2006-8-16 11:57  資料  個人空間  主頁 短消息  加為好友  添加 Jay.W 為MSN好友 通過MSN和 Jay.W 交談