ecshop如何对文章页面浏览次数进行统计

更新时间:2014-10-15 点击量:1380

 如何增加文章的浏览量,这个问题客户提到,在此分享一下经验:


 
第一,修改ecshop文章表  

 

   alter table ecs_article add column click_count int(1) default  0;//这个是增加统计浏览次数的字段。



第二,在文章详细页面增加这段代码。  

 

  $db -> query("update ".$ecs->table('article')." set click_count=click_count + 1 where article_id = '$article_id'");

 

这段代码在目录下article.php文件处插入。



第三,详细页面显示文章浏览次数   

 

$count = $db -> getOne("select click_count from  ".$ecs->table('article')." where article_id = '$article_id'");    $smarty -> assign('count',$count);



第四,详细页面的调用。

 

    文章浏览次数:{$count}次。



打开ecshop根目录下的themes/您的模板目录/article.dwt

 

查找

 

{$article.author|escape:html} / {$article.add_time}

 

然后{$article.author|escape:html} / {$article.add_time}

 

文章浏览次数:{$count}次 。

 

即可。

支付宝扫码打赏 微信打赏

如果文章对您有帮助,就打赏一个吧

在线客服

客户服务

热线电话:

13128985956 服务时间:

周一到周六:9:00-18:00

在线QQ客服

在线微信客服

关于我们 常见问题

支付方式 加盟合作

提交需求
优惠红包 购物车0 反馈留言 返回顶部