开发者

CakePHP and Plugins

开发者 https://www.devze.com 2023-01-25 03:56 出处:网络
I need to create plugins that hook into the functionality o开发者_高级运维f my main application. CakePHP plugins only instantiate themselves when its own controller is called meaning I cannot affect t

I need to create plugins that hook into the functionality o开发者_高级运维f my main application. CakePHP plugins only instantiate themselves when its own controller is called meaning I cannot affect the processes of my main application.

mainapp/action2baffected
myplugin/

I like the idea of having self contained pluggable models , is there any other way to get this to work? Creating models on the fly etc or write a plugin system from scratch with no cakeiness!


You can use components and behaviors (from the plugins) into your core application. There is one very good presentation of Pierre MARTIN Using reusing-plugins. It's a really inspirational resource.


We have put quite a lot of work into making plugins truly self contained in Infinitas You can have a look at some of the methods that are used, but the main code is in the events. Everything from cache configs, db connections and include assets like css/js are done from within the plugin, even injecting some markup into views is handled.

0

精彩评论

暂无评论...
验证码 换一张
取 消