調用織夢全站評論總數其實很簡單,比如用dedecms搭建博客類型的網站就可以用該方法調用評論總數,本文給大家介紹一個簡單的方法,使用JS調用評論,而且可以使用到DEDECMS中的任何地方!
第一步:首先在plus目錄下,建立一個名為feedcount.php的文件,代碼如下:
1
2 3 4 5 6 7 8 9 |
document.write("共有<?php
require_once(dirname(__FILE__)."/../include/common.inc.php"); $row=$db->GetOne("select count(*) as fc from dede_feedback "); if(!is_array($row)){ echo"0"; }else{ echo$row['fc']; } ?>條評論內容!"); |
第二步:然后在你的中需要顯示評論總數的地方,加入以下JS代碼:
1
|
<script type="text/javascript"src="{dede:field name='phpurl'/}/feedcount.php?aid={dede:field.id/}"></script>
|