acaz โพสต์ 2007-11-6 12:28:51

Mod Pet Display viewthread



รายละเอียด : แสดงข้อมูลสัตว์เลี้ยงของผู้ใช้ที่หน้ากระทู้ต่างๆ
สำหรับและความต้องการของระบบ: Discuz 6.0.0 + Pet Thai For Discuz! 6.0.0
เจ้าของ : alan888 ( http://www.alan888.com/Discuz/index.php )
ภาษาไทย (บางส่วน) : acaz ( http://www.cazdesign.com/forums/index.php )
ไฟลล์ที่ต้องแก้ไข : viewthread.php, viewthread.htm และ css.htm
ไฟลล์ที่เพิ่มเข้ามา : userpetinfo.htm
ตัวอย่างเมื่อทำเสร็จ :


ขั้นตอนการติดตั้ง



เปิดไฟลล์ viewthread.php (ROOT)
ค้นหาSELECT p.*, m.uid, m.username,เปลี่ยนเป็นSELECT p.*, mp.*, m.uid, m.username AS username,ค้นหา
LEFT JOIN {$tablepre}members m ON m.uid=p.authoridเพิ่มโค๊ดนี้ในบรรทัดต่อไป
LEFT JOIN {$tablepre}mypetdata mp ON mp.username=p.authorค้นหา
$firstpid, $videoopenเพิ่มโค้ดนี้ต่อท้ายก่อน ';'
, $petsettings, $petdirค้นหา$post['attachments'] = array();เพิ่มโคดนี้ไปด้านบน
if ($post){
@include DISCUZ_ROOT.'./forumdata/cache/plugin_pet.php';
$petdir = $_DPLUGIN['pet']['vars']['imgdir'];
$petsettings = $_DPLUGIN['pet']['vars'];
$post['petusername'] =rawurlencode($post['username']);
$t=time();
$today = gmdate ("Ymd",$t);
$post['petdiff'] = time() - $post['petregdate'];
$post['petregdate']=gmdate ("Ymd",$post['petregdate']);
$post['pett'] = $today-$post['petregdate'];
$post['petlevel'] = pow (log10 ($post['mypetexp']), 3);
$post['petshowlevel'] = floor ($post['petlevel'] + 1);
$post['levelpic']=intval($post['petshowlevel']/10);
$post['levelpic'] = $post['levelpic'] > '10' ? '11' : $post['levelpic'];
$post['level1']=intval($post['petshowlevel']/2);
$post['level2']=intval($post['petshowlevel']/2);
$post['petpic']=$post['mypetname'];
$post['pethp']=$post['mypethp'];
$post['petatk']=$post['mypetatk']+$post['item1']+$post['item2']+2+$post;
$post['petdef']=$post['mypetdef']+$post['item3']+$post['item4']+$post['item5']+3+$post['level1'];
if($post['petshowlevel']<2){$post['petmaxhp']=$petsettings['basichp'];}
else{$post['petmaxhp']=$petsettings['basichp']+$post['petshowlevel']*5;}
$post['petsp']=$post['mypetsp']-$post['pett']*$petsettings['basicsp2'];
if($post['petsp']>$petsettings['basicsp']){$post['petsp']=$petsettings['basicsp'];}
$post['hpf']= floor (100 * ($post['pethp'] / $post['petmaxhp']));
$post['spf']= floor (100 * ($post['petsp'] / $petsettings['basicsp']));

$post['pethp'] = $post['pethp'] < '0' ? '0' : $post['pethp'];
$post['petsp'] = $post['petsp'] < '0' ? '0' : $post['petsp'];
$post['petdead'] = $post['pethp'] < '1' || $post['petsp'] < '1' ? 'ตาย' : 'มีชีวิต';
$post['petsex'] = $post['mypetsex'] < '2' ? 'เพศผู้' : 'เพศเมีย';
$post['petpk'] = $post['openpk'] < '2' ?'พร้อมรบ' : 'ไม่พร้อมรบ';
$post['hpf'] = $post['hpf'] >= '100' ? '100' : $post['hpf'];
$post['spf'] = $post['spf'] >= '100' ? '100' : $post['spf'];
}เปิดไฟลล์ css.htm (อยู่ที่ templates/default) แล้วเพิ่มโค๊ดนี้ก่อนที่บรรทัดสุดท้าย/*-----------userpetinfo-------------*/
.chart { border: 1px solid {BORDERCOLOR}; width:120px; height:9px; padding: 0em; background: #FFFFFF;}
.chart img { float:left;}เปิดไฟลล์ viewthread.htm (อยู่ที่ templates/default)

ค้นหา<!--{if $post['authorid'] && $post['username'] && !$post['anonymous']}-->เพิ่มโค๊ดนี้ไว้ด้านบน<!--{if $post}-->
<a href="plugin.php?identifier=pet&module=pet&index=viewpet&username=$post['petusername']" target="_blank" id="userpetinfo$post" class="dropmenu" onmouseover="showMenu(this.id,false,0,2,500,0,this.id,500)" style="text-align:right; float:right; font-weight:normal;">สัตว์เลี้ยง</a>
<!--{/if}-->ค้นหา<!--{if $post['authorid'] && $post['username'] && !$post['anonymous']}-->เพิ่มโค๊ดนี้ไว้ด้านบน
<!--{if $post}-->
{template userpetinfo}
<!--{/if}-->บันทึกทั้งหมด

ดาวน์โหลดไฟลล์ userpetinfo.htm ไปไว้ที่ ROOT/templates/default

เสร็จเรียบร้อย

hostman โพสต์ 2007-11-7 12:54:31

มันเป็นต่างดาวแก้ไม่หายซักที่ครับงมหลายที่ไม่รู้มันอยู่ตรงไหน - -"


http://img233.imageshack.us/img233/6032/12984692og7.gif

acaz โพสต์ 2007-11-7 13:02:40

ตอบกลับโพสของ 2# hostman

ดูที่ไฟลล์ viewthread.php นะครับแล้ว เซฟใหม่ (save as) เลือกเป็น UTF-8 ครับ

thaizeal โพสต์ 2007-11-30 02:30:55

โหลดแล้ว :lolขอบคุณครับ

Thum โพสต์ 2007-12-10 14:48:07

ขอบคุณมากๆครับ

snecker โพสต์ 2007-12-12 19:28:45

สุดยอดเลยครับ

theclone โพสต์ 2007-12-15 07:42:48

เยี่ยมเลยครับ

ronatia โพสต์ 2007-12-17 10:53:26

ขอบคุณครับ :hug:

DiowX โพสต์ 2007-12-23 23:43:23

ของผม เหมือนมานไปอยู่ ข้างหลังแหะ..

เอาเมาส์ชี้ แว้วมานไม่มาอยู่ ข้างหน้า..

ทำไงดีงับเนี่ย

:(

DiowX โพสต์ 2007-12-24 08:10:23

ของผม ทำไมเปงแบบนี้ อ่ะงับ..

มองไม่เหงคำว่า สัตว์เลี้ยง.. เอาเมาส์ ไปชี้ ก้อไม่มี popup ออกมา

ชื่อคนโพส ก้อมองไม่เห็น..แหะๆ...

แก้ตรงไหนได้งับเนี่ย.. พยามยามหามาวันนึงแระงับ..

ขอบคุงงับ..

[ แก้ไขล่าสุด DiowX เมื่อ 2007-12-24 08:16 ]
หน้า: [1] 2 3 4 5 6 7 8 9 10
ดูในรูปแบบกติ: Mod Pet Display viewthread