All Projects → Quarkay → Typecho Viewscounter

Quarkay / Typecho Viewscounter

Licence: gpl-2.0
A plugin of typecho for statisticing the visit counts of the posts.

Labels

Projects that are alternatives of or similar to Typecho Viewscounter

DownloadFile
Typecho文件下载插件,使下载的文件保持上传时的文件名。
Stars: ✭ 12 (-45.45%)
Mutual labels:  typecho
Story For Typecho
Typecho Theme Story - 爱上你我的故事
Stars: ✭ 277 (+1159.09%)
Mutual labels:  typecho
Onekey caddy php7 sqlite3
小内存 VPS 一键搭建 Caddy+PHP7+Sqlite3 环境 (支持VPS最小内存64M),一键翻墙 caddy+web(php+sqlite3)+v2ray+bbr。
Stars: ✭ 435 (+1877.27%)
Mutual labels:  typecho
Typecho-Theme-Pui
Pui是一款简洁的双栏typecho主题
Stars: ✭ 50 (+127.27%)
Mutual labels:  typecho
Moricolor For Typecho
Typecho Theme Moricolor - 森之色
Stars: ✭ 255 (+1059.09%)
Mutual labels:  typecho
Typecho Theme Material
Material Design theme for typecho.
Stars: ✭ 366 (+1563.64%)
Mutual labels:  typecho
ArmX
typecho主题及插件ArmX
Stars: ✭ 46 (+109.09%)
Mutual labels:  typecho
Typecho Theme Void
🐒 猴子打字机原理的产物
Stars: ✭ 541 (+2359.09%)
Mutual labels:  typecho
Typecho Theme Next
(重构中)Hexo 主题 NexT.Mist 的 Typecho 移植版
Stars: ✭ 258 (+1072.73%)
Mutual labels:  typecho
Typecho Theme Aria
Typecho Theme Aria - 书写自己的篇章
Stars: ✭ 422 (+1818.18%)
Mutual labels:  typecho
typecho-plugin-Restful
Yet another awesome Typecho plugin to make your blog RESTful.
Stars: ✭ 41 (+86.36%)
Mutual labels:  typecho
typecho-theme-MDUI2333
基于MDUI制作的typecho主题
Stars: ✭ 82 (+272.73%)
Mutual labels:  typecho
Aplayer Typecho
在线音乐播放器插件 for typecho 1.0
Stars: ✭ 381 (+1631.82%)
Mutual labels:  typecho
PandaBangumi-Typecho-Plugin
给博客添加精美的追番展示页吧!
Stars: ✭ 65 (+195.45%)
Mutual labels:  typecho
Single
🎈 一个简洁大气,含夜间模式的 Typecho 博客主题
Stars: ✭ 439 (+1895.45%)
Mutual labels:  typecho
iThumb
Typecho文章缩略图插件
Stars: ✭ 14 (-36.36%)
Mutual labels:  typecho
Miracles
🎉 A simple but powerful single-column theme for Typecho
Stars: ✭ 365 (+1559.09%)
Mutual labels:  typecho
Pio
🎃 一个支持更换 Live2D 模型的纯 JS 插件
Stars: ✭ 626 (+2745.45%)
Mutual labels:  typecho
Typecho Theme Material
Material Design theme for typecho.
Stars: ✭ 464 (+2009.09%)
Mutual labels:  typecho
Editormd
Markdown 编辑器 Editor.md for Typecho
Stars: ✭ 389 (+1668.18%)
Mutual labels:  typecho

Typecho-ViewsCounter

简介

ViewsCounter 插件用于记录 Typecho 每篇文章的浏览次数(可设置对同一篇文章的多次浏览行为是否计入浏览量的时间间隔),同时提供获取浏览最多文章的功能。使用时需要与 Typecho 主题的代码配合。

安装

  1. 首先将本项目克隆到本地:

    git clone [email protected]:Quarkay/Typecho-ViewsCounter.git
    
  2. 将子文件夹 ViewsCounter 复制到 Typecho 插件目录

    cp -r Typecho-ViewsCounter/ViewsCounter /path...to...your...typecho/usr/plugins/
    
  3. 在Typecho后台点击启用并进行相关设置如下图:

    配置设置例子

主题调用插件方法

直接在需要显示的地方插入相应的调用代码即可

  1. 显示文章浏览次数 ( ?? Views 的效果)

    // ... context ...
    <?php echo ViewsCounter_Plugin::getViews(); ?> Views
    // ... context ...
    
  2. 获取最多浏览量文章

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

    具体可用字段参考如下:

    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)
    

License

The GNU General Public License (GPL) V2

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].