本文实例讲述了帝国CMS扣除会员积分置顶修改方法。分享给大家供大家参考。具体实现方法如下:
1、在所需的系统模型中添加int字段 top 单选按钮0,1(0为否,1为是)
2、修改e/class/qinfofun.php 在文件中找到
esetcookie("lastaddinfotime",time(),time()+3600*24);
一直到 //-------------
全部替换为:
//置顶扣分
$t=$empire->fetch1("select top from {$dbtbpre}ecms_".$tbname." where userid='$muserid' and id='$id' and classid='$classid' limit 1");
if($t[top])
{
$w=$empire->fetch1("select userfen from {$dbtbpre}enewsmember where userid='$muserid'");
if($w[userfen]>=10)
{
$sql3=$empire->query("update {$dbtbpre}enewsmember set userfen=userfen-10 where userid='$muserid'");
printerror("AddQinfoSuccess",$reurl,1);
}
else
{
$sql4=$empire->query("update {$dbtbpre}ecms_".$tbname." set top=0 where userid='$muserid' and id='$id' and classid='$classid' limit 1");
printerror("jifenbugou",$reurl,1);
}
}
else{printerror("AddQinfoSuccess",$reurl,1);}
}
else
{printerror("DbError","history.go(-1)",1);}
}
$t=$empire->fetch1("select top from {$dbtbpre}ecms_".$tbname." where userid='$muserid' and id='$id' and classid='$classid' limit 1");
if($t[top])
{
$w=$empire->fetch1("select userfen from {$dbtbpre}enewsmember where userid='$muserid'");
if($w[userfen]>=10)
{
$sql3=$empire->query("update {$dbtbpre}enewsmember set userfen=userfen-10 where userid='$muserid'");
printerror("AddQinfoSuccess",$reurl,1);
}
else
{
$sql4=$empire->query("update {$dbtbpre}ecms_".$tbname." set top=0 where userid='$muserid' and id='$id' and classid='$classid' limit 1");
printerror("jifenbugou",$reurl,1);
}
}
else{printerror("AddQinfoSuccess",$reurl,1);}
}
else
{printerror("DbError","history.go(-1)",1);}
}
3、修改e/class/qinfofun.php 在文件中找到
if($sql)
{
$reurl=DoingReturnUrl("ListInfo.php?mid=$mid",$add['ecmsfrom']);
if($add['editgotoinfourl']&&$infor['checked'])//返回内容页
{
if($cr['showdt']==1)
{
$reurl=$public_r[newsurl]."e/action/ShowInfo/?classid=$classid&id=$id";
}
elseif($cr['showdt']==2)
{
$reurl=$public_r[newsurl]."e/action/ShowInfo.php?classid=$classid&id=$id";
}
else
{
$reurl=$titleurl;
}
}
{
$reurl=DoingReturnUrl("ListInfo.php?mid=$mid",$add['ecmsfrom']);
if($add['editgotoinfourl']&&$infor['checked'])//返回内容页
{
if($cr['showdt']==1)
{
$reurl=$public_r[newsurl]."e/action/ShowInfo/?classid=$classid&id=$id";
}
elseif($cr['showdt']==2)
{
$reurl=$public_r[newsurl]."e/action/ShowInfo.php?classid=$classid&id=$id";
}
else
{
$reurl=$titleurl;
}
}
到 //--------------- 替换为:
//置顶扣分
$t=$empire->fetch1("select top from {$dbtbpre}ecms_".$tbname." where userid='$muserid' and id='$id' and classid='$classid' limit 1");
if($t[top])
{
$w=$empire->fetch1("select userfen from {$dbtbpre}enewsmember where userid='$muserid'");
if($w[userfen]>=10)
{
$sql3=$empire->query("update {$dbtbpre}enewsmember set userfen=userfen-10 where userid='$muserid'");
printerror("EditQinfoSuccess",$reurl,1);
}
else
{
$sql4=$empire->query("update {$dbtbpre}ecms_".$tbname." set top=0 where userid='$muserid' and id='$id' and classid='$classid' limit 1");
printerror("jifenbugou",$reurl,1); </p> <p>
}
}
else{printerror("EditQinfoSuccess",$reurl,1);}
}
else
{printerror("DbError","history.go(-1)",1);}
}
$t=$empire->fetch1("select top from {$dbtbpre}ecms_".$tbname." where userid='$muserid' and id='$id' and classid='$classid' limit 1");
if($t[top])
{
$w=$empire->fetch1("select userfen from {$dbtbpre}enewsmember where userid='$muserid'");
if($w[userfen]>=10)
{
$sql3=$empire->query("update {$dbtbpre}enewsmember set userfen=userfen-10 where userid='$muserid'");
printerror("EditQinfoSuccess",$reurl,1);
}
else
{
$sql4=$empire->query("update {$dbtbpre}ecms_".$tbname." set top=0 where userid='$muserid' and id='$id' and classid='$classid' limit 1");
printerror("jifenbugou",$reurl,1); </p> <p>
}
}
else{printerror("EditQinfoSuccess",$reurl,1);}
}
else
{printerror("DbError","history.go(-1)",1);}
}
注意部分的10为扣除的积分自行设置,还有jifenbuzhu自己可以该为自己需要的提示在e/data/language/gb/pub/q_message.php中添加(gb2312版)
又添加这个字段主要是避免与老大的那个firsttitle起冲突,避免以后升级带来的麻烦
假如会员积分不足提示积分不足但信息仍让可以提交只是不能置顶。
在列表模板中调用方法:
- [e:loop={"select * from phome_ecms_house where top=1 and checked=1 and classid='$GLOBALS[navclassid]' limit 3",3,24,0}]
- <tr onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#F1F5FC'">
- <td><?=$bqr[myarea]?></td>
- <td class="tx"><font color="red">[置顶]</font>
- <a href="<?=$bqsr[titleurl]?>" title="<?=$bqr[title]?>" target="_blank"><?=$bqr[xiangxidizhi]?></a></td>
- <td><?=$bqr[shi]?>室<?=$bqr[ting]?>厅</td>
- <td><?=$bqr[size]?><span class="m">㎡</span></td>
- <td><?=$bqr[money]?></td>
- <td align="right"><?=date('Y-m-d',$bqr[newstime])?></td>
- </tr>
- [/e:loop]
01.23日更新功能添加到期时间字段date到期之后置顶功能无效.
上面的列表模板sql中添加
and (unix_timestamp(youxiaoqi)-UNIX_TIMESTAMP(NOW()))>0
模板大家自己修改,相信不难解决.
上传以下图片:
希望本文所述对大家的帝国CMS建站有所帮助。