[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 編輯 ]