網(wǎng)站中只要啟用了會(huì)員系統(tǒng),網(wǎng)站中的文章就會(huì)有評(píng)論,在網(wǎng)站首頁(yè)中調(diào)用會(huì)員評(píng)論也能提升會(huì)員體驗(yàn)度,網(wǎng)頁(yè)都是靜態(tài)頁(yè)面,如果每有一個(gè)評(píng)論都更新html的話就會(huì)有點(diǎn)浪費(fèi)資源了,所以這里給大家分享一個(gè)使用JS調(diào)用的方法。
1、在plus文件夾下面新建fedcount.php文件 內(nèi)容如下
www.genban.org 網(wǎng)站建設(shè)
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'];
}
?>位用戶了發(fā)表評(píng)論”);
2、在內(nèi)容頁(yè)模板中插入如下代碼調(diào)用
<script type=”text/javascript” src=”/plus/fedcount.php?aid={dede:field name=ID/}”></script>
3、在列表頁(yè)或首頁(yè)模板中插入如下代碼
<script type=”text/javascript” src=”/plus/feedcount.php?aid=[field:id/]“></script>