您的位置:首页 > 运维架构

ecshop给文章页增加一个浏览次数

2012-10-17 17:08 309 查看
如何给ecshop的文章增加浏览次数的功能。ecshop默认是没有浏览次数的功能。

但可以通过修改ecshop文章管理表字段和程序。来实现对ecshop文章页面浏览次数进行统计。

1:修改ecshop文章表.

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

2:在文章详细页面增加以下程序。

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

3:详细页面显示文章浏览次数

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

$smarty -> assign('count',$count);

4:详细页面调用。

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

以上就完成了ecshop详细页面统计和调用。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐