详情页

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

时间:2024年02月05日

编辑:佚名

如何给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详细页面统计和调用。
相关文章
猜你需要