是否可以在CakePHP的插件内部创建插件? [英] Is it possible to create a plugin inside a plugin with CakePHP?

查看:78
本文介绍了是否可以在CakePHP的插件内部创建插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用CakePHP框架在插件中创建插件。

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/.....

我正在使用以下行来加载SbnAdmin插件

I am using the following line to load the SbnAdmin plugin

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

在SbnAdmin引导程序中,我有

And in the SbnAdmin bootstrap I have

CakePlugin::loadAll();

我能够从SbnAdmin插件查看控制器/模型/视图,但是我无法访问SbnChart插件...

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

我尝试过

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?

推荐答案

在您的SbnAdmin引导程序添加:

In your SbnAdmin bootstrap add:

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

我们正在做的是告诉cake添加其他路径来寻找加载插件的方式,这种情况在您的SbnAdmin / Plugin文件夹中。然后我们将随后加载该插件。

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.

您现在应该可以通过常规的 / plugin_name / controller / action 或您的情况 / sbn_chart / controller / action

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

这篇关于是否可以在CakePHP的插件内部创建插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆