Discuz Home Four: Latest topic + Latest Reply + Hot Topic + Essentials Article plugin _php tutorial

Source: Internet
Author: User
Tags dateformat
Home Four: Latest topics + Latest replies + Hot Topics + Essence article for DZ5.5 Official edition
Applicable version: discuz!5.5 official version
Change Difficulty: Easy
Database Upgrade: None
Demo Website: http://fhxye.cn/
Author: I just modified it ~!!!
Updated a bit, thanks [url=profile-uid-141096.html]efrog[/url]:lol
Original sticker: http://www.discuz.net/thread-397572-1-5.html
First step: index.php
Found it:
Copy CodeThe code is as follows:
Require_once Discuz_root. /include/forum.func.php ';

Add below:
Copy CodeThe code is as follows:
Require_once Discuz_root. /include/misc.func.php ';

Found it:
Copy CodeThe code is as follows:
$newthreads = Round (($timestamp-$lastvisit + 600)/1000) * 1000;

Add the following:
Copy CodeThe 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 = "other";
}
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 = "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 = "other";
}

$mem _home = Convertip ($onlineip, $datadir = "./");
info//
$colorarray = Array (' ', ' red ', ' orange ', ' yellow ', ' green ', ' cyan ', ' blue ', ' purple ', ' gray ');
New Stickers//
$hack _cut_str = 24; Change title Display word Count
$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;
}
New Stickers//
New response
$hack _cut_str = 24; Change title Display word Count
$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;
}
Reply//
Hot Posts
$hack _cut_str = 24; Change title Display word Count
$hack _cut_strauthor = 9;
[color=red]//This can choose to install or not install//[/color]
[color=red]//hot paste specified days//[/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_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;
}
Hot Posts//
Essence Posts
$hack _cut_str = 24; Change title Display word Count
$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&lt ;> ' $fid ' and F.fid=t.fid ORDER by T.dateline DESC LIMIT 0, 8 "); Change the number of posts displayed
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;
}
Essence Posts//

If you want to modify the number of displayed bars for the call, modify the following code location (4 to modify)
Copy CodeThe 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] ");

Change the 8 to the number you want it to be.

2./templates/default/discuz.htm
Found it
Copy CodeThe code is as follows:



$advlist [Text]





Add the following:
Copy CodeThe code is as follows:



$advlist [Text]

















≡ Latest topic ≡ ≡ Latest reply ≡ ≡ Hot topics ≡ ≡ Essence article ≡



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]








http://www.bkjia.com/PHPjc/318447.html www.bkjia.com true http://www.bkjia.com/PHPjc/318447.html techarticle Home Four: Latest topic + Latest Reply + Hot Topic + Essence Article forDZ5.5 version: discuz!5.5 Official Edition revision difficulty: Easy Database Upgrade: No demo website: Http://fhxye ...

  • Related Article

    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.