网站中只要启用了会员系统,网站中的文章就会有评论,在网站首页中调用会员评论也能提升会员体验度,网页都是静态页面,如果每有一个评论都更新html的话就会有点浪费资源了,所以这里给大家分享一个使用JS调用的方法。

1、在plus文件夹下面新建fedcount.php文件 内容如下
document.write(“共有<?php
require_once(dirname(__FILE__).”/../include/common.inc.php”);
$row = $db->GetOne(“select count(*) as fc from dede_feedback
where aid=’{$aid}’”);
if(!is_array($row)){
echo “0″;
}else {
echo $row['fc'];
}
?>位用户了发表评论”);
 
2、在内容页模板中插入如下代码调用
<script type=”text/javascript” src=”/plus/fedcount.php?aid={dede:field name=ID/}”></script>
 
3、在列表页或首页模板中插入如下代码
<script type=”text/javascript” src=”/plus/feedcount.php?aid=[field:id/]“></script>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-26
  • 2021-12-30
  • 2021-04-21
  • 2021-06-22
  • 2021-09-01
  • 2022-12-23
猜你喜欢
  • 2021-06-15
  • 2021-12-14
  • 2021-04-15
  • 2022-12-23
  • 2021-07-31
  • 2022-12-23
相关资源
相似解决方案