Quarkay / Typecho Viewscounter
Licence: gpl-2.0
A plugin of typecho for statisticing the visit counts of the posts.
Stars: ✭ 22
Labels
Projects that are alternatives of or similar to Typecho Viewscounter
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 Material
Material Design theme for typecho.
Stars: ✭ 366 (+1563.64%)
Mutual labels: typecho
Typecho Theme Next
(重构中)Hexo 主题 NexT.Mist 的 Typecho 移植版
Stars: ✭ 258 (+1072.73%)
Mutual labels: typecho
typecho-plugin-Restful
Yet another awesome Typecho plugin to make your blog RESTful.
Stars: ✭ 41 (+86.36%)
Mutual labels: typecho
Miracles
🎉 A simple but powerful single-column theme for Typecho
Stars: ✭ 365 (+1559.09%)
Mutual labels: typecho
Typecho Theme Material
Material Design theme for typecho.
Stars: ✭ 464 (+2009.09%)
Mutual labels: typecho
Typecho-ViewsCounter
简介
ViewsCounter 插件用于记录 Typecho 每篇文章的浏览次数(可设置对同一篇文章的多次浏览行为是否计入浏览量的时间间隔),同时提供获取浏览最多文章的功能。使用时需要与 Typecho 主题的代码配合。
安装
-
首先将本项目克隆到本地:
git clone [email protected]:Quarkay/Typecho-ViewsCounter.git
-
将子文件夹 ViewsCounter 复制到 Typecho 插件目录
cp -r Typecho-ViewsCounter/ViewsCounter /path...to...your...typecho/usr/plugins/
-
在Typecho后台点击启用并进行相关设置如下图:
主题调用插件方法
直接在需要显示的地方插入相应的调用代码即可
-
显示文章浏览次数 ( ?? Views 的效果)
// ... context ... <?php echo ViewsCounter_Plugin::getViews(); ?> 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 ...
具体可用字段参考如下:
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
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].