任意页面动态调用购物车数量,不用刷新数据。
同时适用于帝国CMS6.6、7.0
新建一个buycarjs.php文件放在/e/shopsys/buycar/下,代码如下:
<?phprequire(“../../class/connect.php”);require(“../../class/q_functions.php”);require(“../../class/db_sql.php”);require(“../../data/dbcache/class.php”);eCheckCloseMods(‘shop’);//关闭模块$link=db_connect();$empire=new mysqlquery();$editor=1;$buycar=getcvar(‘mybuycar’);$record=”!”;$r=explode($record,$buycar);$count=count($r)-1;?>document.write(” <?=$count?> “);
模板页面调用代码:
<a href=”/e/ShopSys/buycar/” target=”_blank”>购物车<script src=”/e/ShopSys/buycar/buycarjs.php”></script>件</a>