免费电子图书馆


我们DEDE现在的评论总数是静态的 如果每次评论都更新HTML吧 又太费资源
论坛看到很多朋友都没解决 研究了一下  用了JS方式调用 只查询了一个字段
应该不会很浪费资源 这个有待测试。应该不会占资源。

方法如下 分两步。

1.在PLUS下新建fedcount.php文件 内容如下

document.writeln("共有 <?php
require(dirname(__FILE__)."/../include/config_base.php");
$db = new DedeSql(false);
$rs = $db->GetOne("SELECT postnum FROM #@__archives WHERE ID='{$aid}'");
if(!is_array($rs)){
echo "0";
}else {
echo $rs['postnum'];
}
?>位网友发表了评论");

2.在内容页模板中插入如下代码

<script type="text/javascript" src="/plus/fedcount.php?aid={dede:field name=ID/}"></script>

 

作者:mlzy@牧龙在野!
地址:http://www.zhanghongbiao.com/post/529/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!

技术 | 评论(0) | 引用(0) | 阅读(238)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]