原帖
http://www.alan888.com/Discuz/thread-125644-1-2.html
演示:
http://www.byaudi.com/ek/index.php
修改文件:index.php
discuz.htm
1.修改index.php
找
複製內容到剪貼簿
代碼:
$newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000;在下面加入
複製內容到剪貼簿
代碼:
$today = mktime (0,0,0,date("m") ,date("d"),date("Y"));
$build_date = mktime (0,0,0,10,30,2006);//請修改後面的三個數字,分別代表你論壇運行第一天的月,日,年。
$build_days = (int)(($today-$build_date)/(24*3600));
//----首頁四格代碼開始
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
//新貼
$hack_cut_str = 26; //標題字數
$hack_cut_strauthor = 9;
$new_post_threadlist = array();
$nthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid ORDER BY t.dateline DESC LIMIT 0, 9");
while($nthread = $db->fetch_array($query)) {
$nthread['forumname'] = ereg_replace('<[^>]*>','',$nthread['name']);
$nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
$nthread['view_author'] = cutstr($nthread['author'],$hack_cut_strauthor);
$nthread['date']= gmdate("$dateformat $timeformat", $nthread['dateline'] + $timeoffset * 3600);
$nthread['lastreplytime']= gmdate("$dateformat $timeformat", $nthread[lastpost] + ($timeoffset * 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;
}
//新回覆
$hack_cut_str = 26; //標題字數
$hack_cut_strauthor = 9;
$new_reply_threadlist = array();
$rthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 ORDER BY t.lastpost DESC LIMIT 0, 9");
while($rthread = $db->fetch_array($query)) {
$rthread['forumname'] = ereg_replace('<[^>]*>','',$rthread['name']);
$rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
$rthread['view_lastposter'] = cutstr($rthread['lastposter'],$hack_cut_strauthor);
$rthread['date']= gmdate("$dateformat $timeformat", $rthread['dateline'] + $timeoffset * 3600);
$rthread['lastreplytime']= gmdate("$dateformat $timeformat", $rthread[lastpost] + ($timeoffset * 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[] = $rthread;
}
//----首頁四格代碼結束2.修改discuz.htm
找
複製內容到剪貼簿
代碼:
<div id="ad_text"></div>在下面加入
複製內容到剪貼簿
代碼:
<!-- 首頁四格代碼開始 -->
<style type="text/css">
td.4r { width: 25%; }
td.bg4r { background: #FFF url("images/default/portalbox_bg.gif"); background-repeat: repeat-x; background-position: 0 1px; }
</style>
<div class="mainbox">
<span class="headactions">
<img id="page4_img" src="images/default/collapsed_no.gif" title="收起/展開" alt="收起/展開" onclick="toggle_collapse('page4');" />
</span>
<h1 style="text-align: center">$bbname 資訊</h1>
<!--{if empty($gid) && $announcements}-->
<div id="announcement" onmouseover="if(!anncount) {clearTimeout(annst);annst = 0}" onmouseout="if(!annst) annst = setTimeout('announcementScroll()', anndelay);">
<div id="announcementbody"><ul>$announcements</ul></div>
</div>
<script type="text/javascript">
var anndelay = 3000;
var anncount = 0;var annheight = 36;var annst = 0;
function announcementScroll() {
if(!annst) {
$('announcementbody').innerHTML += '
' + $('announcementbody').innerHTML;$('announcementbody').scrollTop = 0;
if($('announcementbody').scrollHeight > annheight * 3) {
annst = setTimeout('announcementScroll()', anndelay);
} else {
$('announcement').onmouseover = $('announcement').onmouseout = null;
}
return;
}
if(anncount == annheight) {
if($('announcementbody').scrollHeight - annheight <= $('announcementbody').scrollTop) {
$('announcementbody').scrollTop = $('announcementbody').scrollHeight / 2 - annheight;
}
anncount = 0;annst = setTimeout('announcementScroll()', anndelay);
} else {
$('announcementbody').scrollTop++;anncount++;annst = setTimeout('announcementScroll()', 10);
}
}
</script>
<!--{/if}-->
<table summary="$bbname 資訊" id="page4" cellspacing="0" cellpadding="0">
<thead class="category">
<tr>
<td class="4r" width="25%"><b>個人資料</b></td>
<td class="4r" width="25%"><b>論壇資訊</b></td>
<td class="4r" width="25%"><b>最新發表</b></td>
<td class="4r" width="25%"><b>最新回帖</b></td>
</tr>
</thead>
<tr>
<td valign="top" class="bg4r">
<!--{if !$discuz_user}-->
<form method="post" name="login" action="logging.php?action=login">
<input type="hidden" name="formhash" value="{FORMHASH}" />
<input type="hidden" name="referer" value="$referer" />
強烈建議您 <a href="register.php"><b>{lang register}</b></a>
成為<a href="index.php">$bbname</a> {lang memberlist}:
以獲得『遊客』無法實現的功能
會員登陸:
{lang username}:<input type="text" name="username" size="14" maxlength="15" tabindex="1" />
{lang password}:<input type="password" name="password" size="14" tabindex="2">
<button type="submit" name="loginsubmit" tabindex="4" class="submit">{lang submit}</button> 或 <a href="$link_login">安全{lang login}</a>
</form>
<!--{/if}-->
<!--{if $discuz_uid}-->
<b>$discuz_userss</b> <!--{if $allowinvisible}--><!--{if !empty($invisible)}-->[<a href="member.php?action=switchstatus" title="{lang login_switch_normal_mode}">{lang login_invisible_mode}</a>]<!--{else}-->[<a href="member.php?action=switchstatus" title="{lang login_switch_invisible_mode}">{lang login_normal_mode}</a>]<!--{/if}--><!--{/if}-->
{lang index_status}:<span class="bold"><!--{if $validdays}--><a href="member.php?action=groupexpiry"><span class="bold">$grouptitle</span>($validdays)</a><!--{else}--><span class="bold">$grouptitle</span><!--{/if}--></span>
{lang credits}:<span class="bold">$credits</span>
<!--{loop $extcredits $id $credit}-->
$credit[title]: <span class="bold">$GLOBALS[extcredits.$id]</span> $credit[unit]
<!--{/loop}-->
IP :<span class="bold">$onlineip</span>
{lang lastvisit}:<span class="bold">$lastvisittime</span>
<a href="search.php?srchfrom=$newthreads&searchsubmit=yes" title="{lang show_newthreads}">新帖</a> |
<a href="member.php?action=markread" title="{lang mark_read}">標讀</a> | <a href="my.php?item=threads" title="{lang show_mytopics}">我帖</a> | <a href="digest.php" title="{lang digest}">精華</a> | <!--{if $allowuseblog}--><a href="blog.php?uid=$discuz_uid" target="_blank">{lang blog}</a>
<!--{/if}-->
<!--{/if}-->
</td>
<td valign="top" class="bg4r">
今日發表{lang total}:$todayposts 篇
昨日發表{lang total}:$postdata[0] 篇
發表主題{lang total}:<span class="bold">$threads</span> 篇
帖子總數{lang total}:<span class="bold">$posts</span> 篇
會員總數:<span class="bold">$totalmembers</span> 人
線上人數:<span class="bold">$onlinenum</span> 人
{lang welcome_newmember}:<a href="space.php?action=viewpro&username=$lastmember"><font face="Impact">$lastmember</font></a>
已運行日數:<span class="bold">$build_days</span> 天
適合解析度:1024x768
</td>
<td valign="top" class="bg4r">
<!--{loop $new_post_threadlist $nthread}-->
<!--{if $nthread[replies]}-->
<a href="redirect.php?tid=$nthread[tid]&goto=newpost" title="最新話題 {LF}文章版區: $nthread[forumname]{LF}文章主題: $nthread[subject]{LF}文章{lang author}: $nthread[author]{LF}發表{lang time}: $nthread[date]{LF}瀏覽次數: $nthread[views] 次 {LF}{lang replies}次數: $nthread[replies] 次{LF}最後回覆: $nthread[lastreplytime]{LF}{lang lastpost}: $nthread[lastposter]" $nthread[highlight]>$nthread[view_subject]</a>
<!--{else}-->
<a href="redirect.php?tid=$nthread[tid]&goto=newpost" title="最新話題 {LF}文章版區: $nthread[forumname]{LF}文章主題: $nthread[subject]{LF}文章{lang author}: $nthread[author]{LF}發表{lang time}: $nthread[date]{LF}瀏覽次數: $nthread[views] 次{LF}{lang replies}次數: 暫時沒有回覆" $nthread[highlight]>$nthread[view_subject]</a><!--{/if}-->
$nthread[multipage]
<!--{/loop}-->
</td>
<td valign="top" class="bg4r">
<!--{loop $new_reply_threadlist $rthread}-->
<a href="redirect.php?tid=$rthread[tid]&goto=lastpost#lastpost" title="最新回覆 {LF}文章版區: $rthread[forumname]{LF}文章主題: $rthread[subject]{LF}文章{lang author}: $rthread[author]{LF}發表{lang time}: $rthread[date]{LF}瀏覽次數: $rthread[views] 次{LF}{lang replies}次數: $rthread[replies] 次{LF}最後回覆: $rthread[lastreplytime]{LF}{lang lastpost}: $rthread[lastposter]" $rthread[highlight]>$rthread[view_subject]</a>
$rthread[multipage]
<!--{/loop}--></td>
</tr>
</table>
</div>
<!-- 首頁四格代碼結束 -->找
複製內容到剪貼簿
代碼:
<!--{if $gid || !$discuz_uid}--><a href="$indexname">$bbname</a> <!--{else}--><a href="space.php?action=viewpro&uid=$discuz_uid" class="dropmenu" id="creditlist" onmouseover="showMenu(this.id)">$discuz_user</a> <!--{/if}-->改成
複製內容到剪貼簿
代碼:
<!--{if $gid || !$discuz_uid}--><a href="$indexname">$bbname</a> <!--{else}--><a href="space.php?action=viewpro&uid=$discuz_uid">$discuz_user</a> <!--{/if}-->[
本帖最後由 Windows 於 2007-9-22 09:38 PM 編輯 ]