dedecms5.7动态调用评论数和收藏数

很多时候,我们需要在页面调用评论数和收藏数,织梦dede默认是不支持动态调用评论数和收藏数的,只能自己动手,现在和大家分享实现动态调用评论

数和收藏数的方法。

1、首先在根目录plus/文件下创建文件名为fedcount.php的php页面,,将下面的代码粘贴进去,记得修改数据库前缀名

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'];

}

?>");

2、在需要放置评论数的位置,调用下面的js代码即可

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

3、把下面的代码保存为fedccount.php,记得修改数据库前缀名

document.write("<?php require_once(dirname(__FILE__)."/../include/common.inc.php");

$row = $db->GetOne("select count(*) as c from dede_member_stow where aid='{$aid}' ");

if(!is_array($row))

{

echo "0";

}

else

{

echo $row['c'];

}

?>");

4、在需要放置评论数的位置,调用下面的js代码即可

<script type="text/javascript" src="{dede:field name='phpurl'/}/fedccount.php?aid={dede:field.id/}"></script>

就微笑着同清风合力染绿大地,这样才算善待生命,不负年华。

dedecms5.7动态调用评论数和收藏数

相关文章:

你感兴趣的文章:

标签云: