织梦DEDECMS调用文章评论次数
织梦DEDECMS要调用文章的评论次数,必须要修改数据表(58pic_archives),添加一个字段用于存储这篇文章的评论次数,然后在调用这个字段的值即可。
解决办法
58pic_archives 添加postcount t(10) UNSIGNED default 0然后打开plus\feedback.php 找到大约220左右
//保存评论内容
`arctitle`,`ip`,`ischeck`,`dtime`, `mid`,`bad`,`good`,`ftype`,`face`,`msg`)
'{$cfg_ml->M_ID}','0','0','$feedbacktype','$face','$msg'); ";
if($type == 'ments')
{
$arctitle = addslashes($title);
if($msg!='')
{
$query = "INSERT INTO `cmsxx_feedback`(`aid`,`typeid`,`username`,
VALUES ('$aid','$typeid','$username','$arctitle','$ip','$ischeck','$dtime',
//插入位置1
$rs = $dsql->ExecuteNoneQuery($query);
if(!$rs)
{
echo $dsql->GetError();
exit();
}
//插入位置2
插入位置1内容:
$rowc = $dsql->GetOne("Select count() as count from `58pic_feedback` where aid ='$aid'");
插入位置2内容
$pcount = $rowc ['count'];
$query2 = "update `58pic_archives` set postcount = '$pcount' where id = '$aid'";
$rs = $dsql->ExecuteNoneQuery($query2);
if(!$rs)
{
echo $dsql->GetError();
exit();
}