ecshop文章页增加显示文章浏览次数统计【ECSHOP教程】
在ecshop中,如何增加文章的浏览量,专业性也比较强,这个问题很多用户相当的关心,在此分享一下经验:
第一,修改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);
第四,在ECSHOP模板文章详细页面的调用。
文章浏览次数:{$count}次。
打开ecshop根目录下的 themes/模板文件夹/,找到article.dwt 查找 {$article.author|escape:html} / {$article.add_time} 这个,然后{$article.author|escape:html} / {$article.add_time} 文章浏览次数:{$count}次 就可以了。
2308
本文模板屋原创地址:https://www.ecshop119.com/ecshopjc-438.html © 模板屋版权所有 转载时必须以链接形式注明出处。