ViewsCounter - 文章浏览次数统计及排行榜
ViewsCounter 插件用于记录 Typecho 每篇文章的浏览次数(可设置对同一篇文章的多次浏览行为是否计入浏览量的时间间隔),同时提供获取浏览最多文章的功能。使用时需要与 Typecho 主题的代码配合。
显示文章次数:
// ... context ...
<?php echo ViewsCounter_Plugin::getViews(); ?> Views
// 也可以传入 cid 使用如下
<?php echo ViewsCounter_Plugin::getViewsById($this->cid); ?> Views
// ... context ...
调用热度文章
// ... context ...
<?php foreach (ViewsCounter_Plugin::getMostViewed() as $post): ?>
<h3><a href="<?php echo $post['permalink'] ?>"><?php echo $post['title'] ?></a></h3>
...
...
<?php endforeach; ?>
// ... context ...
开发者:https://github.com/Quarkay/Typecho-ViewsCounter