[mod] แสดงค่าประสบการณ์ที่แถบข้อมูลส่วนตัว 7.0 / 7.1 / 7.2
แก้ไขล่าสุดโดย dsiwarsza เมื่อ 2009-12-19 09:27แก้ไขล่าสุดโดย dsiwarsza เมื่อ 2009-12-19 09:27
ที่มา http://www.alan888.com/Discuz/
สืบจาก http://www.discuzthai.com/thread-8833-1-2.html
ตัวอย่าง : http://www.bf-thai.net/bbs/thread-2-1-1.html
จาก 7.00 ทำเหมือนกานเลยนะคับ ใช้ได้ 100 เปอร์ทดสอบแล้ว
ขอรูปจาก theerawutนะคับผม
ไฟล์ที่ทำการแก้ไข
bbs/include/global.func.php
bbs/viewthread.php
bbs/templates/default/viewthread_node.htm
วิธีการทำ
1. เปิดไฟล์bbs/include/global.func.php
เพิ่มโค๊ดนี้ไว้บรรทัดล่างสุด ก่อน ?>function getexp($credits,$usergid){
global $_DCACHE;
if($_DCACHE['usergroups'][$usergid]['type'] != 'member' || $_DCACHE['usergroups'][$usergid]['creditslower'] == '999999999' || $_DCACHE['usergroups'][$usergid]['creditshigher'] == '-999999999'){
$exp ="
<span class=small>ประสบการณ์ : สูงสุด</span>
<tablecellspacing=0 cellpadding=0>
<thead><tr>
<td align=left height=13><img height=9 src=images/default/blue.gif width=98%><img height=9 src=images/default/exp.gif></td>
</tr></thead></table>";
}else{
$range = $_DCACHE['usergroups'][$usergid]['creditslower'] - $_DCACHE['usergroups'][$usergid]['creditshigher'];
$haveget = $credits - $_DCACHE['usergroups'][$usergid]['creditshigher'];
$need = $range - $haveget;
$ep = intval($haveget*100/$range);
$wid = intval(97*$ep/100);
$exp ='
<span class=small>ค่าประสบการณ์: '.$ep.' %
และต้องการอีก<font color=blue>'.$need.'</font>เพื่อเปลี่ยนระดับ</span>
<tablecellspacing=0 cellpadding=0>
<thead><tr>
<td align=left height=13><img height=9 src=images/default/blue.gif width='.$wid.'%><img height=9 src=images/default/exp.gif></td>
</tr></thead></table>';
}
return $exp;
}2. เปิดไฟล์ bbs/viewthread.php
ค้นหา$post['dateline'] = dgmdate("$dateformat $timeformat", $post['dateline'] + $timeoffset * 3600);เพิ่มโค๊ดนี้ด้านล่าง$post['userexp'] = getexp($post['credits'],$post['groupid']);3.เปิดไฟล์bbs/templates/default/viewthread_node.htm
ค้นหา<!--{if $post['customstatus']}--><p class="customstatus">$post</p><!--{/if}-->เพิ่มโค๊ดนี้ด้านล่าง<p>$post</p>4.แตกไฟล์แล้วอัพโหลดไปยังตำแหน่งต้นฉบับ
http://www.discuzthai.com/images/attachicons/rar.gifimages_level.rar (872 Bytes)
5.อัพเดชแคช เสร็จสมบูรณ์ ขอบคุณครับ ขอบคุณครับ ขอบคุณคร้าบ ขอบคุณครับ ขอบคุณครับ ขอบคุณครับ ขอบคุณครับ ขอบคุณครับ ขอบคุณครับ