日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

PhpWind教程:總積分(綜合積分)顯示在文章頁面(read)的方法(For 6.3.2 7.0)_PhpWind教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

有人要總積分的顯示方法,這個(gè)數(shù)據(jù)庫里沒現(xiàn)成的字段,是根據(jù)現(xiàn)有的威望金錢等算出來的
打開read.php
搜索
$read['groupid']==6 && $read['honor'] = '';
下面加上
     //總積分計(jì)算開始
        $usercredit=array(
            'postnum'    => $read['postnum'],
            'digests'    => $read['digests'],
            'rvrc'        => $read['rvrc'],
            'money'        => $read['money'],
            'credit'    => $read['credit'],
            'onlinetime'=> $read['onlinetime'],
        );
        include(D_P.'data/bbscache/config.php');
        $upgradeset = unserialize($db_upgrade);
        foreach($upgradeset as $key=>$val){
            if(is_numeric($key)){
                foreach(GetCredit($read['uid']) as $key=>$value){
                    $usercredit[$key] = $value[1];
                }
                break;
            }
        }
        $read['total'] = CalculateCredit($usercredit,$upgradeset);
        //總積分計(jì)算結(jié)束
 
然后在這個(gè)文件最后
?>
之前,加上
//總積分計(jì)算開始
function GetCredit($uid){
    global $db,$_CREDITDB;
    $credit = array();
    if (is_array($_CREDITDB)) {
        foreach ($_CREDITDB as $key => $value) {
            $credit[$key] = array($value[0],0);
        }
    }
    $query = $db->query("SELECT cid,value FROM pw_membercredit WHERE uid='$uid'");
    while ($rt = $db->fetch_array($query)) {
        $credit[$rt['cid']] = array($_CREDITDB[$rt['cid']][0],$rt['value']);
    }
    return $credit;
}
function CalculateCredit($creditdb,$upgradeset){
    $credit=0;
    foreach($upgradeset as $key=>$val){
        if($creditdb[$key] && $val){
            if($key == 'rvrc'){
                $creditdb[$key] /= 10;
            } elseif($key == 'onlinetime'){
                $creditdb[$key] /= 3600;
            }
            $credit += $creditdb[$key]*$val;
        }
    }
    return (int)$credit;
}
//總積分計(jì)算結(jié)束

然后打開template/wind/read.htm
找到
發(fā)帖: $read[postnum]

前面加上
總積分: $read[total]

當(dāng)然這個(gè)位置隨您喜好而定


 

查看更多 PhpWind教程  PhpWind模板風(fēng)格

來源:Phpwind//所屬分類:PhpWind教程/更新時(shí)間:2012-06-06
相關(guān)PhpWind教程