列印

純轉帖加修改4格

純轉帖加修改4格

原帖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 編輯 ]
附件: 您所在的用戶組無法下載或查看附件
入我相思門 當知相思苦    長相思兮長相憶 短相思兮無窮盡

Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP

回覆 1# 的帖子

剛測了一下,此版若未修改掉原有公告

會有二個公告出現,不過此版確實很適合

新入手的大大按裝,比較沒問題
複製內容到剪貼簿
代碼:
<!--{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}-->
Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP

回覆 2# 的帖子

是  忘了公告那一段  thank you
入我相思門 當知相思苦    長相思兮長相憶 短相思兮無窮盡

Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP

回覆 3# 的帖子

呵呵~~~不客氣啦

也感謝你轉此帖給一些需要四格的大大
Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP

使用成功

但是有點問題

就是有點擠..請問怎麼解決呢?

以下如圖:

Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP

<br /> 放在 code 裡面會有問題

D6 的 Bug
Hack 安裝錯誤, 80% 來自粗心, 請專心安裝
Linux0911 打造您的個性論壇

本人現在忙於研究所, 沒多的時間管論壇, 有問題別發 pm 給我, 謝謝~
Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP

加左之後變左咁呀
可以點做呀thx
附件: 您所在的用戶組無法下載或查看附件
Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP



論壇聲明
  • 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
    如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
    請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!
最佳瀏覽解析度:不低於 1024 (最佳 1280 以上).(支援 IE 7, Mozilla Firefox, Safari, Chrome)
The Best Surfing Resolution: No Lower than 1024 (Best: above 1280).(IE 7, Mozilla Firefox, Safari, Chrome Supported)