網(wǎng)(LieHuo.Net)教程 以前在5.1版的時(shí)候,_archives表中直接有個(gè)postnum可以顯示共顯示評(píng)論總數(shù),可是在5.3卻把這個(gè)字段給舍了,那么如何調(diào)出對(duì)文檔的評(píng)論總數(shù)呢?找論壇里看到一位朋友的對(duì)5.1版時(shí)使用JS調(diào)用評(píng)論總數(shù)的方法改了改,請(qǐng)接著看...
首先在plus目錄下,建立一個(gè)文件名為:feedcount.php,注意你的編碼喔.內(nèi)容如下:
以下為引用的內(nèi)容: 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)論"); |
然后在你的模板中需要顯示評(píng)論總數(shù)的地方,加入以下JS代碼:
以下為引用的內(nèi)容: <script type="text/javascript" src="{dede:field name='phpurl'/}/feedcount.php?aid={dede:field.id/}"></script> |
下一篇 盲目交換友情鏈接的誤區(qū)