Discuz homepage: Latest topic + latest reply + hot topic + excellent article plug-in _ php instance

Source: Internet
Author: User
Discuz homepage: Latest topic + latest reply + popular topic + excellent article plug-in homepage: Latest topic + latest reply + popular topic + excellent article for DZ5.5 official version
Applicable version: Discuz! 5.5 official version
Difficulty in modification: Easy
Database Upgrade: None
Demo site: http://fhxye.cn/
Author: I just modified it ~!!!
Updated. Thank you for choosing url1_profile-uid-142.166.html] efrog [/url]: lol
Original post: http://www.discuz.net/thread-397572-1-5.html
Step 1: index. php
Find:

The Code is as follows:


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


Add the following:

The Code is as follows:


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


Find:

The Code is as follows:


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


Add the following:

The Code is as follows:


// --------------- 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 = "Others ";
}
// The above is the 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 = "Window 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 = "other ";
}

$ Mem_home = convertip ($ onlineip, $ datadir = "./");
// Info //
$ Colorarray = array ('', 'red', 'Orange ', 'yellow', 'green', 'cyany', 'blue', 'purple ', 'Gray ');
// New post //
$ Hack_cut_str = 24; // modify the number of words displayed in the title
$ 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 _ subobject'] = cutstr ($ nthread ['subobject'], $ hack_cut_str );
$ Nthread ['view _ author'] = cutstr ($ nthread ['author'], $ hack_cut_strauthor );
$ Nthread ['date'] = gmdate ("$ dateformat $ timeformat", $ nthread ['dateline '] + $ timeoffset x 3600 );
$ Nthread ['lasttime'] = 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;
}
// New post //
// New reply
$ Hack_cut_str = 24; // modify the number of words displayed in the title
$ 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 _ subobject'] = cutstr ($ rthread ['subobject'], $ hack_cut_str );
$ Rthread ['view _ lastposter'] = cutstr ($ rthread ['lastposter'], $ hack_cut_strauthor );
$ Rthread ['date'] = gmdate ("$ dateformat $ timeformat", $ rthread ['dateline '] + $ timeoffset x 3600 );
$ Rthread ['lasttime'] = 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;
}
// Reply //
// Hot posts
$ Hack_cut_str = 24; // modify the number of words displayed in the title
$ Hack_cut_strauthor = 9;
[Color = red] // you can choose whether to install or not. // [/color]
[Color = red] // specifies the number of days for hot pasters. // [/color]
[Color = red] $ this_time = time (); [/color]
[Color = red] $ sort_time = $ today-(60*60*24*7); // within 7 days
[/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 _ subobject'] = cutstr ($ mthread ['subobject'], $ hack_cut_str );
$ Mthread ['view _ lastposter'] = cutstr ($ mthread ['lastposter'], $ hack_cut_strauthor );
$ Mthread ['date'] = gmdate ("$ dateformat $ timeformat", $ mthread ['dateline '] + $ timeoffset x 3600 );
$ Mthread ['lasttime'] = 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;
}
// Hot post //
// Excellent post
$ Hack_cut_str = 24; // modify the number of words displayed in the title
$ 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 "); // modify the number of displayed posts
While ($ dthread = $ db-> fetch_array ($ query )){
$ Dthread ['forumname'] = $ dthread ['name'];
$ Dthread ['view _ subobject'] = cutstr ($ dthread ['subobject'], $ hack_cut_str );
$ Dthread ['view _ author'] = cutstr ($ dthread ['author'], $ hack_cut_strauthor );
$ Dthread ['date'] = gmdate ("$ dateformat $ timeformat", $ dthread ['dateline '] + $ timeoffset x 3600 );
$ Dthread ['lasttime'] = 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;
}
// Excellent post //


If you want to modify the number of display lines of the call, modify the following code location (four to be modified)

The Code is as follows:


$ 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] ");


Modify 8 to the number you want.

2./templates/default/discuz.htm
Find

The Code is as follows:





$ Advlist [text]





Add the following:

The Code is as follows:





$ Advlist [text]

















Latest topics Latest reply Workshop Hot Topic Workshop Cutting-edge Article cutting-edge



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]






Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.