New Toplist สำหรับคนไทยโดยเฉพาะ สวยติดตั้งง่าย
ตัวอย่าง 1 การเข้าสู่ระบบแบบร่วดเร็ว ใช้งานง่ายแค่คลิกเดียว (การนำคำสั่ง popupmenu_popup มาใช้)
ตัวอย่าง 2 การนำคำสั่ง popupmenu_popup มาประยุคใช้ ให้เกิดประโยช์
- แสดงรายชื่อกระดานข่าว ก่อนลิงค์กระทู้ และมีลิงค์ไปที่กระดานนั้นโดยเฉพาะ (ไม่ใช่ลิงค์เดียวกันกับกระทู้นะครับ มี 2 ลิงค์ คือ ลิงค์กระทู้ และลิงค์เข้ากระดานข่าว นะครับ)
- เมื่อคลิกที่ ข้อมูลส่วนตัว ที่สร้างขึ้นมาใหม่ ก็จะแสดงหน้าตาและระบบการทำงานคล้ายๆ ajax เล็กๆ ขึ้นการ บอกว่า
IP: ไอพีของคุณคืออะไร
Home: ที่อยู่ของคุณ
OS: ระบบปฏิบัติการที่คุณใช้
บราวเซอร์: บราวเซอร์ที่คุณใช้ และก็จะมีลิงค์เข้าไป แก้ไขข้อมูล และเปิดอ่าน P.M.
แก้ไขข้อมูล | ข่าวสารส่วนตัว
- เมื่อจะ เข้าสู่ระบบ ก็จะมีเมนูเข้าสู่ระบบอีกทางเลือกเพิ่มเข้ามา มันอาจจะไม่สำคัญเท่าไหร่ เพราะปกติมันก็มีอยู่แล้ว แต่ที่ผมใส่ระบบนี้เข้าไปก็เพราะ Toplist ตัวนี้ทำเพื่อสกินอีกตัวที่กำลัง จะแจกเหมือนกันเร็วๆ นี้เหมือนกัน นะครับ เลยจะมีบางจุดมันไม่ดูดีอ่ะครับ ดังนั้นปรับแต่งเอาเอง
- อาจจะไม่เหมือน Toplist ตัวอื่นๆ อยู่หลายๆ อย่าง ผมพยายามทำให้มันแตกต่างออกไปถ้ามันเหมือนกันมากไป ใครบางคนอาจจะหาว่าผมลอกมาจากตัวนั้นตัวนี้ และแค่มาตั้งชื่อใหม่เท่านั้นเอง อันนี้ก็มีส่วนที่มันแตกต่างออกไปคือ Toplist ทั่วไปแล้วจะบอกว่า สมาชิกใช้งานวันนี้ แต่ตัวนี้จะเป็น สมาชิกดีเด่น นั่นก็คือมันจะแสดงสมาชิก 10 อันดับที่โพสเยอะที่สุด :D เท่านั้นเอง
- if กับ else วางได้ถูกต้องแน่นอน รับรองไม่เพี้ยน สำหรับผู้ดูแลระบบ UID 1 เท่านั้นที่สามารถมองเห็น ผู้ดูแล(ทิปส์) เมื่อคลิกก็จะมี ทิปส์ การปรับแต่ง และเครดิตต่างๆ ที่สำคัญ อย่าลบออกเลยนะครับ สมาชิกเขาไม่เห็นหลอกครับ เห็นแต่ admin คนเดียวแหละครับพี่น้อง
- ปรับแต่งรูป list ใหม่ ให้มันมีสีสันสวยดูดีขึ้น
- altitle แสดงอัตโนมัติ (เฉพาะ หน้าแรก) โดยไม่ต้องไปเพิ่มโค้ด ที่ common.js แต่เจอบัคกับ Opera นะครับ
- เป็นภาษาไทย พร้อม ทิปส์ บอกการทำงานไว้ทุกคำสั่ง ดังนั้นคุณสามารถ ปรับแต่งได้ตามสบาย ถ้าปรับแล้วแหวกแนว เอามาปล่อยให้คนอื่นๆ ใช้ด้วยนะ
มาดูวิธีติดตั้งว่าง่ายแต่ไหน
อันดับแรกแน่นอนเปิดไฟล์ index.php ขั้นมาแล้วหา$newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000;วางโค้ดนี้ด้านล้าง
//----เริ่มทำงาน windtoplist
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
//กระทู้ล่าสุด
$hack_cut_str = 70; //ความยาวของ กระทู้ที่จะให้แสดง
$hack_cut_strauthor = 10;
$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 AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.dateline DESC LIMIT 0, 10");//10 กระทู้เท่านั้น
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 + ($timeoffset * 3600));
if($nthread['highlight']) {
$string = sprintf('%02d', $nthread['highlight']);
$stylestr = sprintf('%03b', $string);
$nthread['highlight'] = 'style="';
$nthread['highlight'] .= $stylestr ? 'font-weight: bold;' : '';
$nthread['highlight'] .= $stylestr ? 'font-style: italic;' : '';
$nthread['highlight'] .= $stylestr ? 'text-decoration: underline;' : '';
$nthread['highlight'] .= $string ? 'color: '.$colorarray[$string] : '';
$nthread['highlight'] .= '"';
} else {
$nthread['highlight'] = '';
}
$new_post_threadlist[] = $nthread;
}
//ตอบกลับล่าสุด
$hack_cut_str = 70; //ความยาวของ กระทู้ที่จะให้แสดง
$hack_cut_strauthor = 10;
$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.fidAND t.closed NOT LIKE 'moved|%' AND t.replies !=0 AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.lastpost DESC LIMIT 0, 10");
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 + ($timeoffset * 3600));
if($rthread['highlight']) {
$string = sprintf('%02d', $rthread['highlight']);
$stylestr = sprintf('%03b', $string);
$rthread['highlight'] = 'style="';
$rthread['highlight'] .= $stylestr ? 'font-weight: bold;' : '';
$rthread['highlight'] .= $stylestr ? 'font-style: italic;' : '';
$rthread['highlight'] .= $stylestr ? 'text-decoration: underline;' : '';
$rthread['highlight'] .= $string ? 'color: '.$colorarray[$string] : '';
$rthread['highlight'] .= '"';
} else {
$rthread['highlight'] = '';
}
$new_reply_threadlist[] = $rthread;
}
//กระทู้ร้อนแรง
$hack_cut_str = 70; //ความยาวของ กระทู้ที่จะให้แสดง
$hack_cut_strauthor = 10;
$new_hot_threadlist = array();
$mthread = array();
$ctime=$timestamp-3600*24*7;
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fidAND t.closed NOT LIKE 'moved|%' AND t.replies !=0 AND t.dateline>$ctime AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.replies DESC LIMIT 0, 10");
while($mthread = $db->fetch_array($query)) {
$mthread['forumname'] = ereg_replace('<[^>]*>','',$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 + ($timeoffset * 3600));
if($mthread['highlight']) {
$string = sprintf('%02d', $mthread['highlight']);
$stylestr = sprintf('%03b', $string);
$mthread['highlight'] = 'style="';
$mthread['highlight'] .= $stylestr ? 'font-weight: bold;' : '';
$mthread['highlight'] .= $stylestr ? 'font-style: italic;' : '';
$mthread['highlight'] .= $stylestr ? 'text-decoration: underline;' : '';
$mthread['highlight'] .= $string ? 'color: '.$colorarray[$string] : '';
$mthread['highlight'] .= '"';
} else {
$mthread['highlight'] = '';
}
$new_hot_threadlist[] = $mthread;
}
//กระทู้สำคัญ
$hack_cut_str = 70; //ความยาวของ กระทู้ที่จะให้แสดง
$hack_cut_strauthor = 10;
$new_digest_threadlist = array();
$dthread = array();
$dtime=$timestamp-3600*24*30;
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fidAND t.closed NOT LIKE 'moved|%' AND t.replies !=0 AND t.dateline>$dtime AND t.digest in (1,2,3) AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.replies DESC LIMIT 0, 10");
while($dthread = $db->fetch_array($query)) {
$dthread['forumname'] = ereg_replace('<[^>]*>','',$dthread['name']);
$dthread['view_subject'] = cutstr($dthread['subject'],$hack_cut_str);
$dthread['view_lastposter'] = cutstr($dthread['lastposter'],$hack_cut_strauthor);
$dthread['date']= gmdate("$dateformat $timeformat", $dthread['dateline'] + $timeoffset * 3600);
$dthread['lastreplytime']= gmdate("$dateformat $timeformat", $dthread + ($timeoffset * 3600));
if($dthread['highlight']) {
$string = sprintf('%02d', $dthread['highlight']);
$stylestr = sprintf('%03b', $string);
$dthread['highlight'] = 'style="';
$dthread['highlight'] .= $stylestr ? 'font-weight: bold;' : '';
$dthread['highlight'] .= $stylestr ? 'font-style: italic;' : '';
$dthread['highlight'] .= $stylestr ? 'text-decoration: underline;' : '';
$dthread['highlight'] .= $string ? 'color: '.$colorarray[$string] : '';
$dthread['highlight'] .= '"';
} else {
$dthread['highlight'] = '';
}
$new_digest_threadlist[] = $dthread;
}
//แสดงรายชื่อสมาชิก โพสสูงสุด
$today = array();
$query = $db->query("SELECT uid, username, posts FROM {$tablepre}members ORDER BY posts DESC LIMIT 10");
while($variable = $db->fetch_array($query)) {
$today[] = array('uid'=>$variable['uid'], 'username'=>$variable['username'], 'posts'=>$variable);
}
// ตัวแปลเข้าไปเรียก OS, บราเซอร์
if(!$statstatus && $discuz_uid){
require_once DISCUZ_ROOT.'./include/counter.inc.php';
}
require_once DISCUZ_ROOT.'./include/misc.func.php';
$mem_home = convertip($onlineip, $datadir = "./");
require_once DISCUZ_ROOT.'./forumdata/cache/cache_todayvisit.php';
$todayvisit=$_DCACHE['todayvisit']['0']['COUNT(*)'] ;
@include './forumdata/cache/cache_newtopic.php';
@include './forumdata/cache/cache_newreply.php';
//----จบ windtoplistSave ให้เป็น UTF-8
เปิดไฟล์ discuz.htm ขึ้นมาแล้วหา<!--{else}--><div id="ad_text"></div><!--{/if}-->วางโค้ดนี้ ที่บรรทัดต่อไป{template top}เนื่องจากตัวสคริปต์ ทันเยอะไป ถ้าให้มันไปดึง template ที่สร้างขึ้นมาใหม่คือ top.htm
จากนั้นก็ save ให้เป็น UTF-8
อัพโหลดไฟล์ขึ้นโฮสต์ ไปวางที่ตำแหน่งที่กำหนดมาให้เลย
**** Hidden Message *****
[ แก้ไขล่าสุด mastergtx เมื่อ 2008-6-26 10:51 ] ใครที่ใช้จอขนาด 1024 ถ้ากระทู้มันยาวตกบรรทันหรือเพี้ยน ลองปรับ$hack_cut_str = 70;ให้เลือกแค่ 55 หรือ 60 ดูนะครับ
และไฟล์ pic.php อย่าลืมกำหนด รูปจากกระดานด้วยหละครับ สำหรับการโพสรูปนั้นแนะนำให้ใช้ IE โพสนะครับ มันถึงจะขึ้น ถ้าใช้ Firefox โพสรูปไม่ขึ้น จะบอกว่าเน่าอีกหละครับเพราะทำไม่เป็นเองไงหุหุ
29-06-2008 แก้บัค
กำลังจะแจ้งบัคนี้เหมือนกัน แก้แบบนี้นะครับ เปิดไฟล์ index.php หา
require_once DISCUZ_ROOT.'./forumdata/cache/cache_todayvisit.php';
ลบทิ้งได้เลยครับ
[ แก้ไขล่าสุด mastergtx เมื่อ 2008-6-29 13:26 ] ขอชมหน่อยนะครับ โอ้ว ขอบคุณมากเลยครับ แนวดี ~~ ขอชมหน่อยนะครับ