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

ecshop优化10-对文章页面浏览次数进行统计

2013-08-17 18:49 267 查看
http://www.ecmoban.com/article-1516.html

在ecshop中,如何增加文章的浏览量,专业性也比较强,这个问题很多用户相当的关心,在此模板堂(www.ecmoban.com)分享一下经验:

第一,修改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/Genuine/,找到article.dwt 查找 {$article.author|escape:html} / {$article.add_time} 这个,然后{$article.author|escape:html} / {$article.add_time} 文章浏览次数:{$count}次 就可以了。

这样描述不知道大家清楚了吗?最后谢谢A5论坛热心站长的支持。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: