此个人信息美化添加宠物贴间显示方法:
【第一步】修改 viewthread.php 文件
1、查找:在其后面紧跟加入:- , pd.petname, pd.mypetpic, pd.pettype, pd.mypetjob, pd.mypetlevel, pd.mypetexp, pd.mypethp, pd.mypetmaxhp, pd.mypetsp, pd.mypetmp, pd.mypetmaxmp, pd.mypetgood
复制代码 2、查找:- LEFT JOIN {$tablepre}memberfields mf ON mf.uid=m.uid
复制代码 在其下面加入:- LEFT JOIN {$tablepre}wxpetdata pd ON pd.username=m.username
复制代码 3、查找:- $forum['allowbbcode'] = $forum['allowbbcode'] ? ($_DCACHE['usergroups'][$post['groupid']]['allowcusbbcode'] ? 2 : 1) : 0;
复制代码 在其上面加入:
- //宠物数据>>>>>>>>>>>> >>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- if($post['petname']!=''){
- $petjob = $post['mypetjob'];
- $petlevel= $post['mypetlevel'];
- $levelpic = ($petlevel/10)>11?11:intval($petlevel/10);
- if ($petjob == 0 or ($petjob <=3 && $petlevel < 200) or $post['mypetpic']=='') {
- $post['petpic'] = "<img src=czwpet/images/pet/$post[pettype]/$post[pettype]$levelpic.gif border=0>";
- } else {
- $post['petpic'] = "<img src=$post[mypetpic] border=0>";
- }
-
- $petlevelfloor = pow (log10 (ceil($post['mypetexp']/ ($petjob * 0.2 + 1))), 3);
- $epf=intval (100 * ($petlevelfloor - intval ($petlevelfloor)));
- $hpf = floor (100 * ($post['mypethp'] / $post['mypetmaxhp']));
- $mpf = $post['mypetmaxmp']?(floor (100 * ($post['mypetmp'] / $post['mypetmaxmp']))):0;
- $spf = floor (100 * ($post['mypetsp'] / 5000)) - 1;
- $post['epf']=$epf>97?97epf;
- $post['hpf']=$hpf>97?97hpf;
- $post['mpf']=$mpf>97?97mpf;
- $post['spf']=$spf>97?97spf;
-
- $post['petdead']=($post['mypetsp'] && $post['mypethp'])?'生存':'死亡';
- $petgood = $post['mypetgood'];
- if ($petgood >= 100) {
- $post['love'] = "死忠";
- }elseif($petgood >=50) {
- $post['love']="忠诚";
- }elseif($petgood >= -50) {
- $post['love'] = "猜疑";
- }elseif($petgood > -100) {
- $post['love'] = "厌恶";
- }else{
- $post[love] = "<font color=red>不鸟!</font>";
- }
- }
- //宠物数据<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<
复制代码 【第二步】修改 templates/default/show.htm
1,查找:- <!--{if $post['authorid'] && $post['username'] && !$post['anonymous']}-->
复制代码 在其上面加入:- <!--{if $post[petname]}-->
- <a href="pet.php?index=viewpet&username=$post[author]" target="_blank" id="userpetinfo$post[pid]" class="dropmenu" onmouseover="showMenu(this.id,false,0,2,500,0,this.id,500)" style="text-align:right; float:right; font-weight:normal;"><img src="wxpet/images/tiejian.gif" /></a>
- <!--{/if}-->
复制代码 其中<img src="wxpet/images/tiejian.gif" />你可以改成文字类型 <font color=red>宠物资讯</font>
或者wxpet/images/tiejian.gif这个改成你自定义的图片地址
【第三步】修改 templates/default/viewthread.htm
1、查找:
- <!--{if $post['authorid'] && $post['username'] && !$post['anonymous']}-->
复制代码 在其上面加入:
- <div class="popupmenu_popup userinfopanel" id="userpetinfo$post[pid]_menu" style="display: none;width:180px">
- <div align="left">
- <font color=red>宠物名字:</font><a href="pet.php?index=viewpet&username=$post[author]">$post[petname]</a>
- <div align="center">$post[petpic]</div>
- 宠物状态: $post[petdead] $post[love] <br/>
- 宠物级别: $post[mypetjob] 转/ $post[mypetlevel] 级<br/>
- HP: $post[mypethp] / $post[mypetmaxhp]
- <table width='120px' border='0' cellspacing='0' cellpadding='0' bordercolor='#000000'>
- <tr>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src='czwpet/images/rpg/img_left.gif' width=3></TD>
- <TD style="padding:0px;" height=13 background= "czwpet/images/rpg/img_backing.gif" ><img src='czwpet/images/rpg/orange.gif' width=' $post[hpf]%' height='9'><img src=' czwpet/images/rpg/hp.gif' height='9'></td>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src='czwpet/images/rpg/img_right.gif' width=3></TD>
- </tr>
- </table>
- MP: $post[mypetmp] / $post[mypetmaxmp]
- <table width='120' border='0' cellspacing='0' cellpadding='0' bordercolor='#000000'>
- <tr>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src='czwpet/images/rpg/img_left.gif' width=3></TD>
- <TD style="padding:0px;" height=13 background="czwpet/images/rpg/img_backing.gif"><img src='czwpet/images/rpg/blue.gif' width=' $post[mpf]%' height='9'><img src=' czwpet/images/rpg/exp.gif' height='9'></td>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src='czwpet/images/rpg/img_right.gif' width=3></TD>
- </tr>
- </table>
- SP: $post[mypetsp] / 5000
- <table width='120' border='0' cellspacing='0' cellpadding='0' bordercolor='#000000'>
- <tr>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src='czwpet/images/rpg/img_left.gif' width=3></TD>
- <TD style="padding:0px;" height=13 background="czwpet/images/rpg/img_backing.gif"><img src=' czwpet/images/rpg/green.gif' width='$post[spf]%' height='9'><img src=' czwpet/images/rpg/mp.gif' height='9'></td>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src=' czwpet/images/rpg/img_right.gif' width=3></TD>
- </tr>
- </table>
- EXP: $post[epf]%
- <table width='120' border='0' cellspacing='0' cellpadding='0' bordercolor='#000000'>
- <tr>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src='czwpet/images/rpg/img_left.gif' alt= $post[mypetexp] width=3></TD>
- <TD style="padding:0px;" height=13 background="czwpet/images/rpg/img_backing.gif"><img src='czwpet/images/rpg/blue.gif' width='$post[epf]%' alt= $post[mypetexp] height='9'><img src=' czwpet/images/rpg/exp.gif' height='9'></td>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src='czwpet/images/rpg/img_right.gif' alt= $post[mypetexp] width=3></TD>
- </tr>
- </table>
- </div> </div>
复制代码 最后,保存上传,刷新,ok了。
PS:第一次发插件贴,那个。。。下面附件怎么显示详细信息啊?。。。
[ 本帖最后由 meeny 于 2008-9-24 00:09 编辑 ] |