LSRONG-双荣设计
扫描二维码添加QQ好友

扫一扫二维码,加我QQ

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

2016-03-27 11:03:08ecshop常见问题

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

 
第一,修改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}次 。

 

即可。

文章关键词