brucenan 发表于 2015-3-24 16:14:19

项目想支持第三方插件的集成,结构上如何处理?

我们的项目想做一个开放的结构,基本功能固定,附加的功能作为第三方插件来实现,但目前CI的架构,想实现的的代码一般都要分别写在
/Controller
/Model
/View
这三个目录下,有没有什么办法,或者是否可以实现下面的结构:
/Controller
/Model
/View
/Plugins
/Plugins/PluginA/Controller
/Plugins/PluginA/Model
/Plugins/PluginA/View
/Plugins/PluginB/Controller
/Plugins/PluginB/Model
/Plugins/PluginB/View


就是想让每个第三方插件的所有实现代码,都独立有自己的目录,而不是要把文件分散放到好几个地方。

谢谢!

dy7338 发表于 2015-3-24 16:51:15

本帖最后由 dy7338 于 2015-3-24 16:56 编辑

目录随意写啊,按CI的目录结构用到你的插件上,到时候直接用的时候include就可以

brucenan 发表于 2015-3-24 16:59:43

谢谢,我看了一下文档:
An application package allows for the easy distribution of complete sets of resources in a single directory, complete with its own libraries, models, helpers, config, and language files. It is recommended that these packages be placed in the application/third_party folder

好像只有libraries, models, helpers, config, and language 这几个目录,没有controller和model的支持,那controller和model的功能代码写在哪里?

brucenan 发表于 2015-3-24 20:17:48

回的贴子怎么不见了。

yuzhigang5460 发表于 2015-3-24 21:41:23

brucenan 发表于 2015-3-24 20:17
回的贴子怎么不见了。

看了你的文件结构,感觉不合理。如果你想用插件模式,可以参考一下论坛里的stblog源代码,里面有插件模式的实现方式,推荐。

brucenan 发表于 2015-3-24 22:07:48

谢谢建议,我看一下
页: [1]
查看完整版本: 项目想支持第三方插件的集成,结构上如何处理?