Is it possible to create a plugin inside a plugin with CakePHP?

孤街醉人 提交于 2019-12-12 03:42:18

问题


I am attemping to create a Plugin inside a Plugin using the CakePHP Framework.

My folder structure is like so

app/Plugin/SbnAdmin/Plugin/SbnChart/.....

I am using the following line to load the SbnAdmin plugin

CakePlugin::loadAll(array('SbnAdmin' => array('bootstrap' => true)));

And in the SbnAdmin bootstrap I have

CakePlugin::loadAll();

I am able to view a controller/model/view from the SbnAdmin plugin, but I am unable to access the SbnChart plugin...

I have tried

www..../sbn_admin/sbn_chart/chart/index
www..../sbn_chart/chart/index

With no success and I am not sure what else I can do, Any ideas?


回答1:


In your SbnAdmin bootstrap add:

App::build(array('Plugin' => array(CakePlugin::path('SbnAdmin') . 'Plugin' . DS)));
CakePlugin::load('SbnChart');

What we're doing is telling cake to add additional paths to look for to load the plugins, in this case inside your SbnAdmin/Plugin folder. Then we are loading the plugin afterwards.

You should be able to access it now via the normal /plugin_name/controller/action or in your case /sbn_chart/controller/action



来源:https://stackoverflow.com/questions/11817818/is-it-possible-to-create-a-plugin-inside-a-plugin-with-cakephp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!