文章采集调用(统计记录Typecho博客文章文章浏览次数的Typecho插件安装教程)
优采云 发布时间: 2021-11-08 03:10文章采集调用(统计记录Typecho博客文章文章浏览次数的Typecho插件安装教程)
ViewsCounter插件是一个Typecho插件,用于统计和记录每个文章 typecho博客的浏览量。支持设置同一文章文章的多次浏览是否计入浏览次数的时间间隔。默认值为 3600 秒。另外还支持获取被调用次数最多的文章,并且可以设置被调用的文章的个数。
插件安装教程
1、下载插件:Github
2、解压后将Typecho-ViewsCounter-master文件夹下的ViewsCounter文件夹上传到usr/plugins/目录下
3、登录自己的typecho网站后台,在console-plug-ins中启用名为“ViewsCounter”的插件
4、 启用插件后,点击插件后面的“设置”,进入插件设置界面。该插件提供了两种设置。一是调用次数最多的文章。如果没有调用,则忽略;一是设置同一篇文章文章同一人浏览,多长时间不计入浏览次数
5、在主题的post.php文件中,添加调用浏览量的代码:
1
保存
分机:呼叫观看次数最多的文章
在需要调用的地方添加如下代码
1
2
3
</a>
循环中支持以下字段:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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 '
关于串模式匹配算法,相信很多讲解数据结构的书籍都会有讲解,这里先大概提一下。
### 串模式匹配算法'(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)
如无特别注明,文章将由Blog Bar整理发布,欢迎转载。