首頁 php教程 php手册 discuz 首页四格:最新话题+最新回复+热门话题+精华文章插件

discuz 首页四格:最新话题+最新回复+热门话题+精华文章插件

Jun 13, 2016 pm 12:31 PM
discuz 回覆 外掛 文章 最新 熱門話題 精華 首頁

首页四格:最新话题+最新回复+热门话题+精华文章 for DZ5.5 正式版
适用版本:  Discuz!5.5 正式版
修改难度:  易
数据库升级:  无
演示网站:http://fhxye.cn/
作者:我只是修改罢了~!!!
更新了一下,感谢[url=profile-uid-141096.html]efrog[/url]:lol
原贴:http://www.discuz.net/thread-397572-1-5.html
第一步:index.php
找到:

复制代码 代码如下:


require_once DISCUZ_ROOT.'./include/forum.func.php';


下面加入:

复制代码 代码如下:


require_once DISCUZ_ROOT.'./include/misc.func.php';


找到:

复制代码 代码如下:


$newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000;


下面添加:

复制代码 代码如下:


//---------------hack Meminfo start
if(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "MSIE 6.0")) {
                $visitor_browser = "Internet Explorer 6.0";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "MSIE 5.5")) {
                $visitor_browser = "Internet Explorer 5.5";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "MSIE 5.0")) {
                $visitor_browser = "Internet Explorer 5.0";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "MSIE 4.01")) {
                $visitor_browser = "Internet Explorer 4.01";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "NetCaptor")) {
                $visitor_browser = "NetCaptor";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Netscape")) {
                $visitor_browser = "Netscape";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Lynx")) {
                $visitor_browser = "Lynx";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Opera")) {
                $visitor_browser = "Opera";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Konqueror")) {
                $visitor_browser = "Konqueror";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Mozilla")) {
                $visitor_browser = "Mozilla";
        } else {
                $visitor_browser = "其它";
        }
//上面的是浏览器//
        if(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "NT 5.1")) {
                $visitor_os = "Windows XP";
        }elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "NT 5.2")) {
                $visitor_os = "Windows Server 2003";
        }elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "NT 5")) {
                $visitor_os = "Windows 2000";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "4.9")) {
                $visitor_os = "Windows ME";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "NT 4")) {
                $visitor_os = "Windows NT 4.0";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "98")) {
                $visitor_os = "Windows 98";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "95")) {
                $visitor_os = "Windows 95";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Mac")) {
                $visitor_os = "Mac";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Linux")) {
                $visitor_os = "Linux";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Unix")) {
                $visitor_os = "Unix";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "FreeBSD")) {
                $visitor_os = "FreeBSD";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "SunOS")) {
                $visitor_os = "SunOS";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "BeOS")) {
                $visitor_os = "BeOS";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "OS/2")) {
                $visitor_os = "OS/2";
        } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], ";PC")) {
                $visitor_os = "Macintosh";
        }elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "AIX")) {
                $visitor_os = "AIX";
        } else {
                $visitor_os = "其他";
        }

        $mem_home = convertip($onlineip, $datadir = "./");
//info//
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
//新贴//
$hack_cut_str =24; //修改标题显示字数
$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, 8");
while($nthread = $db->fetch_array($query)) {
        $nthread['forumname'] = $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 = 24; //修改标题显示字数
$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, 8");
while($rthread = $db->fetch_array($query)) {
        $rthread['forumname'] = $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;
}
//回覆//
//热帖
$hack_cut_str = 24; //修改标题显示字数
$hack_cut_strauthor = 9;
[color=red]//这个可以选择安装或者不安装//[/color]
[color=red]//热贴指定天数//[/color]
[color=red]$this_time= time();[/color]
[color=red]$sort_time = $today - ( 60*60*24*7); //7天内
[/color]$new_hot_threadlist = array();
$mthread = 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 [color=red]and t.dateline > $sort_time[/color][b][color=red] [/color][/b]ORDER BY t.views DESC LIMIT 0, 8");
while($mthread = $db->fetch_array($query)) {
        $mthread['forumname'] = $mthread['name'];
        $mthread['view_subject'] = cutstr($mthread['subject'],$hack_cut_str);
        $mthread['view_lastposter'] = cutstr($mthread['lastposter'],$hack_cut_strauthor);
$mthread['date']= gmdate("$dateformat $timeformat", $mthread['dateline'] + $timeoffset * 3600);
        $mthread['lastreplytime']= gmdate("$dateformat $timeformat", $mthread[lastpost] + ($timeoffset * 3600));
        if($mthread['highlight']) {
                $string = sprintf('%02d', $mthread['highlight']);
                $stylestr = sprintf('%03b', $string[0]);

                $mthread['highlight'] = 'style="';
                $mthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
                $mthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
                $mthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
                $mthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
                $mthread['highlight'] .= '"';
        } else {
                $mthread['highlight'] = '';
        }
        $new_hot_threadlist[] = $mthread;
}
//热帖//
//精华帖
$hack_cut_str =24; //修改标题显示字数
$hack_cut_strauthor = 9;
$new_digest_threadlist = array();
$dthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE digest>'0' AND t.fid'$fid' AND f.fid=t.fid ORDER BY t.dateline DESC LIMIT 0, 8"); //修改显示帖子条数
while($dthread = $db->fetch_array($query)) {
        $dthread['forumname'] = $dthread['name'];
        $dthread['view_subject'] = cutstr($dthread['subject'],$hack_cut_str);
        $dthread['view_author'] = cutstr($dthread['author'],$hack_cut_strauthor);
        $dthread['date']= gmdate("$dateformat $timeformat", $dthread['dateline'] + $timeoffset * 3600);
        $dthread['lastreplytime']= gmdate("$dateformat $timeformat", $dthread[lastpost] + ($timeoffset * 3600));
        if($dthread['highlight']) {
                $string = sprintf('%02d', $dthread['highlight']);
                $stylestr = sprintf('%03b', $string[0]);
                $dthread['highlight'] = 'style="';
                $dthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
                $dthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
                $dthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
                $dthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
                $dthread['highlight'] .= '"';
        } else {
                $dthread['highlight'] = '';
        }
        $new_digest_threadlist[] = $dthread;
}
//精华帖//


如果要修改调用的显示条数,则修改以下代码位置(有4处要修改)

复制代码 代码如下:


$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, [b][color=red]8[/color][/b]");


把8修改成你要的数目就可以了.

2./templates/default/discuz.htm
找到

复制代码 代码如下:



        


        

        $advlist[text]

        




下面添加:

复制代码 代码如下:



        


        

        $advlist[text]

        





        
    
    
    
    
    
        
              



≡最新话题≡ ≡最新回复≡ ≡热门话题≡ ≡精华文章≡

        

z $nthread[view_subject]

$nthread[view_subject]
 $nthread[view_author]




z
$rthread[view_subject]
 $rthread[view_lastposter]




z
$mthread[view_subject]
 $mthread[view_lastposter]




v
$dthread[view_subject]
 $dthread[view_author]








本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

使用ddrescue在Linux上恢復數據 使用ddrescue在Linux上恢復數據 Mar 20, 2024 pm 01:37 PM

DDREASE是一種用於從檔案或區塊裝置(如硬碟、SSD、RAM磁碟、CD、DVD和USB儲存裝置)復原資料的工具。它將資料從一個區塊設備複製到另一個區塊設備,留下損壞的資料區塊,只移動好的資料區塊。 ddreasue是一種強大的恢復工具,完全自動化,因為它在恢復操作期間不需要任何干擾。此外,由於有了ddasue地圖文件,它可以隨時停止和恢復。 DDREASE的其他主要功能如下:它不會覆寫恢復的數據,但會在迭代恢復的情況下填補空白。但是,如果指示工具明確執行此操作,則可以將其截斷。將資料從多個檔案或區塊還原到單

分享Edge瀏覽器不支援此外掛程式的三種解決方法 分享Edge瀏覽器不支援此外掛程式的三種解決方法 Mar 13, 2024 pm 04:34 PM

  用戶使用Edge瀏覽器的過程中可能會添加一些插件來滿足自己更多的使用需求。但是在添加插件時顯示不支援此插件,這該如何解決?今日小編就來給大家分享三種解決方法,快來試試看。  方法一:嘗試用其他的瀏覽器。  方法二:瀏覽器上的FlashPlayer可能過時或遺失,導致此外掛程式不受支援狀態,可在官網下載最新版本。  方法三:同時按下「Ctrl+Shift+Delete」鍵。  點選“清除資料”,重新開啟瀏覽器即可。

今日頭條發布文章怎麼有收益?今日頭條發布文章獲得更多收益方法! 今日頭條發布文章怎麼有收益?今日頭條發布文章獲得更多收益方法! Mar 15, 2024 pm 04:13 PM

一、今日頭條發布文章怎麼有收益?今日頭條發布文章獲得更多收益方法! 1.開通基礎權益:原創文章選擇投放廣告可獲得收益,影片必須原創橫屏才會有收益。 2.開通百粉權益:粉絲量達百粉以上,微頭條、原創問答創作及問答均可獲得收益。 3.堅持原創作品:原創作品包含文章、微標題及問題等,要求300字以上。注意違規抄襲作品作為原創發布,會被扣信用分,即使有收益也會被扣除。 4.垂直度:做專業領域一類的文章,不能隨意跨領域寫文章,會得不到合適的推薦,達不到作品的專和精,難以吸引粉絲讀者。 5.活躍度:活躍度高,

Discuz註冊流程詳解:讓您輕鬆修改個人訊息 Discuz註冊流程詳解:讓您輕鬆修改個人訊息 Mar 13, 2024 pm 12:21 PM

《Discuz註冊流程詳解:讓您輕鬆修改個人信息,需要具體代碼示例》Discuz是一款功能強大的社區論壇程序,被廣泛應用於各類網站,在用戶註冊和個人信息修改方面,提供了豐富的功能和介面。本文將為您詳細介紹Discuz的註冊流程,並提供具體的程式碼範例,幫助您輕鬆自訂和修改個人資訊。一、使用者註冊流程在Discuz中,使用者註冊是網站的重要功能之一,註冊流程的順暢與

原評論刪除回覆還在嗎?給別人留言刪掉之後別人還能看到嗎? 原評論刪除回覆還在嗎?給別人留言刪掉之後別人還能看到嗎? Mar 23, 2024 pm 05:56 PM

在社群媒體訊息氾濫的今天,人們越來越關注他們在平台上發布的內容以及與他人的互動。當我們在某個帖子下發表評論後,如果原作者將其刪除,這條評論是否會繼續存在,成為一個備受爭議的問題。一、原評論刪除回覆還在嗎?首先,需要明確的是,社群媒體平台在處理用戶資訊和互動方面具有很高的靈活性。儘管原始評論被刪除,但回應通常仍然保留在帖子下方,即使它們可能看起來沒有直接聯繫,但仍然存在。這意味著即使原始評論已經消失,後來的讀者仍然可以看到回复,並根據這些回复推測出一些信息。因此,刪除原評論並不能完全消除互動的痕

Discuz用戶必備!改名道俱全面解析! Discuz用戶必備!改名道俱全面解析! Mar 12, 2024 pm 10:15 PM

Discuz用戶必備!改名道俱全面解析!在Discuz論壇中,改名功能一直備受用戶關注與需求。對於一些需要改名的使用者來說,透過改名道具可以輕鬆實現使用者名稱的修改,而且這也是一種有趣的互動方式。以下就讓我們深入探討Discuz中的改名道具,包括如何取得、如何使用、一些常見問題的解決方法。 1.取得改名道具在Discuz中,改名道具通常是透過點數購買或管理員

驍龍處理器排名最新榜單 驍龍處理器排名最新榜單 Mar 22, 2024 am 11:33 AM

驍龍處理器一直以其出色的性能和穩定的表現贏得了廣泛的認可,是手機和平板電腦等行動裝置的首選處理器之一。隨著科技的不斷發展,驍龍處理器也不斷更新換代,每一代新品都會引起廣泛關注。近日,一家權威機構發布了最新的驍龍處理器排名榜單,讓人們對各款處理器的效能有了更清晰的了解。首先,根據榜單顯示,驍龍8系列處理器一直是效能最強勁的處理器之一,在市場上備受追捧。最新發

有趣的抖音留言回覆句子怎麼寫?回評論回覆有什麼好處? 有趣的抖音留言回覆句子怎麼寫?回評論回覆有什麼好處? Mar 21, 2024 pm 06:01 PM

在這個平台上,除了觀賞有趣的短視頻,瀏覽有趣的評論也成為了許多用戶樂在其中的體驗。有趣的抖音評論回覆不僅能引發笑聲,還能引起共鳴,有時還能為內容增添亮點。一、有意思的抖音評論回覆句子怎麼寫? 1.結合時事熱點:時事熱點是大家關注的焦點,將其融入評論回覆中,能迅速引起他人的興趣。例如,在抖音上某個熱門舞蹈影片中,你可以評論:「這就是我國疫情期間火起來的『社會搖』嗎?太有活力了!」這樣的評論既幽默又貼切,能讓人會心一笑。運用誇張手法是幽默評論中常見的技巧。透過適度誇大事物或情境,可以讓評論更加有趣,讓

See all articles