piwik 插件开发入门教程

栏目: PHP · 发布时间: 8年前

内容简介:piwik 插件开发入门教程

能阅读英文的小伙伴可以直接去官方读读,不过 piwik 官方文档的确很多,想理清楚需要一点功夫

https://developer. piwik .org/guides/getting-started-part-1

创建一个插件

./console generate:plugin --name="MyPlugin"

There are no commands defined in the “generate” namespace.

开启开发模式

./console development:enable

Development mode enabled

./console generate:plugin --name="MyPlugin"

自定义一个报告

./console generate:report

输入要在哪个插件下 输入MyPlugin

Enter the name of your plugin: MyPlugin

Enter the name of your report, for instance “Browser Families”: Visitors

Enter the report category, for instance “Visitor” (you can reuse any existing category or define a new one): yuexiaosheng

Enter a documentation that describes the data of your report (you can leave it empty and define it later): haha

Enter the report dimension, for instance “Browser” (you can leave it either empty or use an existing one):

WARNING [2017-11-29 10:45:03] /Users/ge/ge/web/php/piwik/plugins/CoreConsole/Commands/GenerateReport.php(72): Warning – sprintf(): Too few arguments – Piwik 3.0.4 – Please report this message in the Piwik forums: http://forum.piwik.org (please do a search first as it might have been reported already)

You should now implement the method called “getVisitors()” in API.php

Enjoy!

一个叫Reports的文件夹创建了。

下面两个文件

GetVisitors.php Base.php

Base.php

protected function init()
    {
        $this->categoryId = 'Yuexiaosheng';
    }

决定了你标签的名称

孩子标签名称

$this->subcategoryId = 'Real-time Reports';
        $this->subcategoryId = $this->name;

目录下API.php是需要填写数据的地方

建立一个单页

$ ./console generate:controller

出来这个文件

Controller (plugins/MyPlugin/Controller.php)

能玩了。此文待续

如果你是一名技术人员可加我QQ 2651-0442-02,如果你是 java 技术人还可以加入QQ群 1784-9136-0

首发地址:月小升博客 –

无特殊说明,文章均为月小升原创,欢迎转载,转载请注明本文地址,谢谢


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

引爆社群:移动互联网时代的新4C法则(第2版)

引爆社群:移动互联网时代的新4C法则(第2版)

唐兴通 / 机械工业出版社 / 69.00元

社群已经被公认为是这个时代的商业新形态,原有的商业逻辑和方法被颠覆,新的基于社群的商业体系和规则亟待构建,今天几乎所有的企业都在为此而努力,都在摸索中前行。 本书提出的“新4C法则”为社群时代的商业践行提供了一套科学的、有效的、闭环的方法论,第1版上市后获得了大量企业和读者的追捧,“新4C法则”在各行各业被大量解读和应用,积累了越来越多的成功案例,被公认为是社群时代通用的方法论。也因此,第1......一起来看看 《引爆社群:移动互联网时代的新4C法则(第2版)》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

URL 编码/解码
URL 编码/解码

URL 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器