织梦Dedecms 任意页面调用获取文章 评论数 和 收藏数

来源:互联网 发布:js改变img的src属性 编辑:程序博客网 时间:2024/05/22 10:41

将以下内容保存为feedcount.php文件,放到plus目录下

/** * * 获取评论数c和收藏数f * * @version        $Id: feedcount.php 2013年3月3日 At:237606118  * @package        Douhuimai * @copyright      Copyright (c) 2013 Douhuimai. * @license        http://help.dedecms.com/usersguide/license.html * @link           http://www.douhuimai.com */document.write("<?phprequire_once(dirname(__FILE__)."/../include/common.inc.php");if(!empty($aid)){if($type=="c"){$row = $db->GetOne("select count(*) as c from dede_feedback where aid='{$aid}'");if($row['c']<1){echo "0";}else {echo $row['c'];}}else if($type=="f"){$frow = $db->GetOne("select count(*) as f from dede_member_stow where aid='{$aid}'");if($frow['f']<1){echo "0";}else {echo $frow['f'];}}}else{echo "0";}?>");



在任意页面调用评论数,aid为文章id

<script type="text/javascript" src="/plus/feedcount.php?aid=[field:id/]&type=c"></script>


调用收藏数

<script type="text/javascript" src="/plus/feedcount.php?aid=[field:id/]&type=f"></script>

原创粉丝点击