Typecho Wiki
每一个作品都值得被记录

Typecho 文章浏览次数统计插件 ViewsCounter

Typecho维基君插件列表 • 3076次浏览 • 发布 2018-07-17 • 更新 2018-07-17
极致加速的V2Ray 助您畅享全球网络 & 搬瓦工VPS最新优惠码

插件简介:

ViewsCounter插件是一款用于统计记录Typecho博客每篇文章浏览次数的Typecho插件,支持设置同一篇文章的多次浏览行为是否计入浏览数量的时间间隔,默认为3600秒,此外还支持获取调用浏览次数最多的文章,并可设置调用的文章数量。

插件教程:

  • 下载插件:Github
  • 解压后,把Typecho-ViewsCounter-master文件夹下的ViewsCounter文件夹上传至usr/plugins/目录
  • 登陆自己的typecho网站后台,在控制台——插件中启用名称为“ViewsCounter”的插件
  • 启用插件后,点击插件后面的“设置”,进入插件设置界面,插件提供了两项设置,一项是浏览次数最多的文章的调用数量,如果自己没有调用,则忽略;一项是设置同一篇文章同一个人浏览,多久时间内不计算入浏览数量

Typecho文章浏览次数统计插件ViewsCounter

  • 在主题的post.php文件,添加文章浏览次数调用代码:
<?php echo ViewsCounter_Plugin::getViews(); ?>

保存即可

扩展:调用浏览量最多的文章
在要调用的位置添加以下代码

<?php foreach (ViewsCounter_Plugin::getMostViewed() as $post): ?>
   <li><a href="<?php echo $post['permalink'] ?>"><?php echo $post['title'] ?></a></li>
<?php endforeach; ?>

循环中支持使用以下字段:

array (size=1)
  0 => 
    array (size=32)
      'cid' => string '5' (length=1)
      'title' => string '文章标题' (length=8)
      'slug' => string '5' (length=1)
      'created' => string '1507556700' (length=10)
      'modified' => string '1512460496' (length=10)
      'text' => string '
                关于串模式匹配算法,相信很多讲解数据结构的书籍都会有讲解,这里先大概提一下。
 
                <!--more-->
 
                ### 串模式匹配算法'(length=102)
      'order' => string '0' (length=1)
      'authorId' => string '1' (length=1)
      'template' => null
      'type' => string 'post' (length=4)
      'status' => string 'publish' (length=7)
      'password' => null
      'commentsNum' => string '0' (length=1)
      'allowComment' => string '1' (length=1)
      'allowPing' => string '1' (length=1)
      'allowFeed' => string '1' (length=1)
      'parent' => string '0' (length=1)
      'views' => string '240' (length=3)
      'categories' => 
        array (size=1)
          0 => 
            array (size=14)
              ...
      'category' => string 'default' (length=7)
      'directory' => 
        array (size=1)
          0 => string 'default' (length=7)
      'date' => 
        object(Typecho_Date)[39]
          public 'timeStamp' => int 1507585500
      'year' => string '2017' (length=4)
      'month' => string '10' (length=2)
      'day' => string '09' (length=2)
      'hidden' => boolean false
      'pathinfo' => string '/archives/5/' (length=12)
      'permalink' => string 'http://127.0.0.1:8001/archives/5/' (length=33)
      'isMarkdown' => boolean true
      'feedUrl' => string 'http://127.0.0.1:8001/feed/archives/5/' (length=38)
      'feedRssUrl' => string 'http://127.0.0.1:8001/feed/rss/archives/5/' (length=42)
      'feedAtomUrl' => string 'http://127.0.0.1:8001/feed/atom/archives/5/' (length=43)
你也许感兴趣:
Typecho 文章浏览计数器插件 Stat
Typecho 文章阅读次数统计和热门文章插件 Views
Typecho 实现博客在线访问人数统计代码 ?
Typecho 留言点赞插件 TeStat
Typecho 热门文章列表插件 TePostViews
Typecho 免插件实现文章浏览次数统计
Typecho 免插件实现文章浏览次数统计(Cookie Enabled)
Typecho 文章评分插件 PostRating

广告声明:文内含有的对外跳转链接(包括不限于超链接、二维码、口令等形式),用于传递更多信息,节省甄选时间,结果仅供参考,Typecho.Wiki所有文章均包含本声明。
本文检索关键词:插件列表
下载地址
关闭浏览器广告屏蔽插件或者注册登陆即可看到下载地址

注册 登陆

  更新时间:2018年07月17日

  文件说明:Typecho 文章浏览次数统计插件 ViewsCounter

  软件作者:Huspy

  下载链接: 链接1 推荐高性价比服务器

厂商投放
添加新评论 »