Is it possible to create a plugin inside a plugin

2019-08-20 15:02发布

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条回答
Melony?
2楼-- · 2019-08-20 15:03

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

查看更多
登录 后发表回答