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

2025-03-29 09:39:16
推荐回答(1个)
回答1:

在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);
第四,详细页面的调用。 文章浏览次数:{$count}次。

开ecshop根目录下的themes/Genuine/,找到article.dwt 查找
{$article.author|escape:html} / {$article.add_time}
这个,然后{$article.author|escape:html} / {$article.add_time}
文章浏览次数:{$count}次 就可以了。