1、首先按照以下的做法把diggtop diggdown 顶踩的字段增加好(必须做的,把diggbot 改为 diggdown)
https://www.jb51.net/cms/39485.html
百分比的实现
第一步修改e/public/ViewClick/index.php
//digg数
elseif($down==5)
{
$r=$empire->fetch1("select diggtop from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
$shownum=$r['diggtop'];
}
//digg数
elseif($down==6)
{
$r=$empire->fetch1("select diggbot from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
$shownum=$r['diggbot'];
}
改成
复制代码代码如下:
//diggtop数
elseif($down==5)
{
$r=$empire->fetch1("select diggtop,diggbot from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
$diggtop=$r['diggtop'];
$diggbot=$r['diggbot'];
if($diggtop+$diggbot==0)
{
$diggtop+$diggbot=1;
}
$tmp1=round($diggtop/($diggtop+$diggbot)*100,2);
$shownum='<div style="background-color: #FFFFFF; width: 80px; border: 1px solid #009900; height: 2px; overflow: hidden; position: relative; float: left; clear: right; margin-top:5px;"><div style="background-color: #009900; height: 2px; width: '.$tmp1.'%; overflow: hidden; position: relative;"></div></div><div style="float:left; clear:right; padding-left:5px; font-size:12px;">'.$tmp1.'% ('.$diggtop.')</div>';
}
//diggbot数
elseif($down==6)
{
$r=$empire->fetch1("select diggtop,diggbot from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
$diggtop=$r['diggtop'];
$diggbot=$r['diggbot'];
if($diggtop+$diggbot==0)
{
$diggtop+$diggbot=1;
}
$tmp1=round($diggbot/($diggtop+$diggbot)*100,2);
$shownum='<div style="background-color: #FFFFFF; width: 80px; border: 1px solid #009900; height: 2px; overflow: hidden; position: relative; float: left; clear: right; margin-top:5px;"><div style="background-color: #009900; height: 2px; width: '.$tmp1.'%; overflow: hidden; position: relative;"></div></div><div style="float:left; clear:right; padding-left:5px; font-size:12px;">'.$tmp1.'% ('.$diggbot.')</div>';
}