Arce 发表于 2021-7-19 14:48:04

帝国cms 顶踩 百分比 数字 完美显示解决

1、首先按照以下的做法把diggtopdiggdown 顶踩的字段增加好(必须做的,把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><div></div></div><div>'.$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><div></div></div><div>'.$tmp1.'% ('.$diggbot.')</div>';
}


文档来源:脚本之家https://www.jb51.net/cms/39499.html
页: [1]
查看完整版本: 帝国cms 顶踩 百分比 数字 完美显示解决