Linux0911
(若不堅持,一切都會變樣 ...) Administrator
1#
大 中
小 發表於 2007-12-8 09:37 PM 主題編號:9945 文章編號:21983
TOP
顯示全部帖子
AL8 首頁四格 加入 今日發文 (四格延伸應用系列)
安裝前請先安裝: AL8
首頁 四格 顯示 for Discuz 6.0.0
http://linux0911.no-ip.info/Discuz/thread-9664-1-1.html
效果如下:
作者:忘了
整理:
Linux0911
功能:在四格顯示今日發文者跟它的發文數量
開始安裝
1. 修改 ./include/cache.func.
php
找到 (添加紅字)
引用: // AL8 首頁四格顯示 - START
'newtopic'=> array('newtopic'),
'newreply'=> array('newreply'),
'todayvisit'=> array('todayvisit'),
'todaypost' => array('todaypost'),
// AL8 首頁四格顯示 - END 找到 (添加紅字)
引用: // AL8 首頁四格顯示 - START
case 'newtopic':
$table = 'threads t, '.$tablepre.'forums f';
$cols = "t.tid, t.subject, t.author, t.dateline, t.views, t.replies, t.lastpost, t.lastposter, t.highlight, f.name";
$fids="填上不需要顯示發新帖區域的 fid 編號, 以逗號作分格, 最後一個不用加上逗號";//例如 "1,2,3";
$conditions = "WHERE t.fid<>'$fid' AND f.fid=t.fid AND f.fid NOT IN ($fids) ORDER BY t.dateline DESC LIMIT 0, 11";
break;
case 'newreply':
$table = 'threads t, '.$tablepre.'forums f';
$cols = "t.tid, t.subject, t.author, t.dateline, t.views, t.replies, t.lastpost, t.lastposter, t.highlight, f.name";
$fids="填上不需要顯示發新帖區域的 fid 編號, 以逗號作分格, 最後一個不用加上逗號";//例如 "1,2,3";
$conditions = "WHERE t.fid<>'$fid' AND f.fid=t.fid AND f.fid NOT IN ($fids) AND t.replies !=0 ORDER BY t.lastpost DESC LIMIT 0, 11";
break;
case 'todayvisit':
$table = 'members';
$cols = "COUNT(*)";
$datecut = time() - (3600 * 24);
$conditions = "WHERE lastactivity>='$datecut' ORDER BY lastvisit DESC";
break;
case 'todaypost':
$table = 'posts';
$cols = 'COUNT(pid) AS num, authorid, author';
$datecut = time() - (3600 * 24);
$conditions = "WHERE dateline>=$datecut GROUP BY authorid ORDER BY num DESC LIMIT 0, 11";
break;
// AL8 首頁四格顯示 - END 找到 (添加紅字)
引用: // AL8 首頁四格顯示 - START
case 'newreply':
$hack_cut_str = 26;
$new_reply_threadlist = array();
$rthread = array();
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
while($rthread = $db->fetch_array($query))
{
$rthread['forumname'] = $rthread['name'];
$rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
$rthread['subject'] = cutstr($rthread['subject'],46);
$rthread['date']= gmdate('Y-n-j G:i', $rthread['dateline'] + 8 * 3600);
$rthread['lastreplytime']= gmdate('Y-n-j G:i', $rthread['lastpost'] + 8 * 3600);
if($rthread['highlight'])
{
$string = sprintf('%02d', $rthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$rthread['highlight'] = 'style="';
$rthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$rthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$rthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$rthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$rthread['highlight'] .= '"';
} else {
$rthread['highlight'] = '';
}
$new_reply_threadlist = "<a href=\"redirect.php?tid=$rthread[tid]&goto=lastpost#lastpost\" title=\"論壇 : $rthread[forumname]\r\n標題: $rthread[subject]\r\n作者: $rthread[author]\r\n發表時間: $rthread[date]\r\n瀏覽次數: $rthread[views] 次\r\n回覆: $rthread[replies] 次\r\n最後回覆: $rthread[lastreplytime]\r\n最後發表: $rthread[lastposter]\" $rthread[highlight]>$rthread[view_subject]</a><br />";
$data[] = array('content' => $new_reply_threadlist);
}
break;
case 'newtopic':
$hack_cut_str = 26;
$new_post_threadlist = array();
$nthread = array();
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
while($nthread = $db->fetch_array($query))
{
$nthread['forumname'] = $nthread['name'];
$nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
$nthread['subject'] = cutstr($nthread['subject'],46);
$nthread['date']= gmdate('Y-n-j G:i', $nthread['dateline'] + 8 * 3600);
$nthread['lastreplytime']= gmdate('Y-n-j G:i', $nthread[lastpost] + 8 * 3600);
if($nthread['highlight'])
{
$string = sprintf('%02d', $nthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$nthread['highlight'] = 'style="';
$nthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$nthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$nthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$nthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$nthread['highlight'] .= '"';
} else {
$nthread['highlight'] = '';
}
$new_post_threadlist = $nthread[replies] ? "<a href=\"redirect.php?tid=$nthread[tid]&goto=lastpost#lastpost\" title=\"論壇: $nthread[forumname]\r\n標題: $nthread[subject]\r\n作者: $nthread[author]\r\n發表時間: $nthread[date]\r\n瀏覽次數: $nthread[views] 次 \r\n回覆: $nthread[replies] 次\r\n最後回覆: $nthread[lastreplytime]\r\n最後發表: $nthread[lastposter]\" $nthread[highlight] >$nthread[view_subject]</a><br />" : "<a href=\"redirect.php?tid=$nthread[tid]&goto=lastpost#lastpost\" title=\"論壇: $nthread[forumname]\r\n標題: $nthread[subject]\r\n作者: $nthread[author]\r\n發表時間: $nthread[date]\r\n瀏覽次數: $nthread[views] 次\r\n回覆: 暫時沒有回覆\" $nthread[highlight] >$nthread[view_subject]</a><br />";
$data[] = array('content' => $new_post_threadlist);
}
break;
case 'todaypost':
$todaypost_memberlist = array();
$todaypost = array();
while($result=$db->fetch_array($query)){
$todaypost_memberlist = "<a href=\"space.php?uid=".$result[authorid]."\" title=\"作者: $result[author]\r\n今日發文數: $result[num] \">".$result[author]."</a> <span style=\"color: red\">[ ".$result[num]." ]</span><br />";
$data[] = array('content' => $todaypost_memberlist);
}
break;
// AL8 首頁四格顯示 - END 更新快取
2. 修改 ./include/newthread.inc.php
找到 (添加紅字)
引用: // AL8 首頁四格顯示 - START
require_once DISCUZ_ROOT.'./include/cache.func.php';
updatecache('newtopic');
updatecache('todaypost');
// AL8 首頁四格顯示 - END 3. 修改 ./include/newreply.inc.php
找到 (添加紅字)
引用: // AL8 首頁四格顯示 - START
require_once DISCUZ_ROOT.'./include/cache.func.php';
updatecache('newreply');
updatecache('newtopic');
updatecache('todaypost');
// AL8 首頁四格顯示 - END 4. 修改
index .php
找到 (添加紅字)
引用: // AL8 首頁四格顯示 - START
if(!$statstatus && $discuz _uid) {
require_once DISCUZ_ROOT.'./include/counter.inc.php';
}
require_once DISCUZ_ROOT.'./include/misc.func.php';
$mem_home = convertip($onlineip, $datadir = "./");
require_once DISCUZ_ROOT.'./forumdata/cache/cache_todayvisit.php';
require_once DISCUZ_ROOT.'./forumdata/cache/cache_todaypost.php';
$todayvisit=$_DCACHE['todayvisit']['0']['COUNT(*)'] ;
@include './forumdata/cache/cache_newtopic.php';
@include './forumdata/cache/cache_newreply.php';
// AL8 首頁四格顯示 - END 5. 修改 foruminfo.htm
找到 (修改紅字為 5)
找到 (使用者欄, 修改其比例適合自己論壇
風格 )
引用: <td style="width: 25% "> 找到 (論壇資料欄, 修改其比例適合自己論壇風格)
引用: <td style="width: 21% "> 找到 (最新文章欄, 修改其比例適合自己論壇風格)
引用: <td style="width: 27% "> 找到 (最新回覆欄, 修改其比例適合自己論壇風格)
引用: <td style="width: 27% "> 找到
複製內容到剪貼簿
代碼: <h4 style="font-size: 11pt">最新回覆文章</h4>
<table cellspacing="0" cellpadding="0">
<!--{loop $_DCACHE['newreply'] $newreply}-->
$newreply[content]
<!--{/loop}-->
</table>
</td>下面添加 (修改紅字比例適合自己論壇風格)
引用: <!--// 今日發文 - START-->
<td style="width: 21% ">
<h4 style="font-size: 11pt">今日發文</h4>
<table cellspacing="0" cellpadding="0">
<!--{loop $_DCACHE['todaypost'] $todaypost}-->
$todaypost[content]
<!--{/loop}-->
</table>
</td>
<!--// 今日發文 - END--> 完成
附件: 您所在的用戶組無法下載或查看附件
Hack 安裝錯誤, 80% 來自粗心, 請專心安裝
Linux0911 打造您的個性論壇
本人現在忙於研究所, 沒多的時間管論壇, 有問題別發 pm 給我, 謝謝~
Linux0911 Forum © 2004-2009 All Rights Reserved.