# newthink3_plugins **Repository Path**: hongweizhiyuan/newthink3_plugins ## Basic Information - **Project Name**: newthink3_plugins - **Description**: 用 newthink 来制作的 plugins 模块儿 - **Primary Language**: PHP - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-05-15 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 插件管理 在 `application\Common\Common\function.php` 中的 `function sp_get_hooks`,有关于钩子函数代码! ## 开发插件 以 `Test` 钩子为例 1、在 plugins 中新建 Test 文件夹,目录如下: ![输入图片说明](https://git.oschina.net/uploads/images/2017/0906/123037_0dc6f63d_7780.png "屏幕截图.png") 2、 `config.php`文件,代码如下: ``` return array ( 'text' => array (// 在后台插件配置表单中的键名 ,会是config[text] 'title' => '文本:', // 表单的label标题 'type' => 'text',// 表单的类型:text,password,textarea,checkbox,radio,select等 'value' => 'hello,ThinkCMF!',// 表单的默认值 'tip' => '这是文本组件的演示' //表单的帮助提示 ) ) ``` 3、 `TestPlugin.class.php`文件 ``` 'Test',//Demo插件英文名,改成你的插件英文就行了 'title'=>'Test插件演示', 'description'=>'Test插件演示', 'status'=>1, 'author'=>'ThinkCMF', 'version'=>'1.0' ); public $has_admin=1;//插件是否有后台管理界面 public function install(){//安装方法必须实现 return true;//安装成功返回true,失败false } public function uninstall(){//卸载方法必须实现 return true;//卸载成功返回true,失败false } //实现的footer钩子方法 public function test($param){ $config=$this->getConfig(); $this->assign($config); $this->display('widget'); } } ``` 4、在 `application/System/hooks.php` 增加`test`,代码如下: ``` 作者:郝飞。 注:此插件需要引用 `jquery `,本身自带的`Baywindow.js` 目录:`/plugins/Baywindow` ### 用法: c.直接在 `模板` 里加 `{:hook('footerfooter')}` ## (二) ReturnTop 返回顶部 ### 用法: c.直接在 `模板` 里加 `{:hook('returntop')}` ## (三) WeixinCode 显示二维码 鉴于目前微信公众号推广的需要,设计此WeixinCode插件,用于在网站每篇文章的末尾附加微信二维码图片和文字描述,如果网站的文章内容具有独特的魅力,就能够为网站吸引到一批忠实的微信订阅用户。