代码点火器子应用程序

发布于 2025-01-04 13:47:06 字数 375 浏览 2 评论 0原文

所以,codeigniter有应用程序和系统。我想添加另一个名为“platform”的文件夹,它将具有与应用程序相同的目录结构(控制器、视图和所有内容)。

我希望它的工作方式是这样的: - 当您加载模型、视图、库、控制器等时,它应该首先检查应用程序(如果不存在,它应该检查平台,如果不存在,它应该显示错误) - 我想在“平台”中制作一些基本模型和控制器,以及“应用程序”中的所有控制器和模型来继承它们 - 我想在“平台”中扩展基本的核心和库类,如果需要,它们将在“应用程序”中扩展

我不知道代码点火器是否已经可以做到这一点,或者是否需要某些东西来做到这一点。

基本上它类似于 cakephp 的插件(如果有人知道它们是如何/工作的)。

问题:

我该怎么做?

So, codeigniter has application and system. I want to add another folder called "platform" and it would have the same directory structure as application (controllers, views and everything).

How I want it to work is like this:
- When you load a model, view, library, controller etc it should first check in application (if it's not there, it should check in platform and if it's not there it should show an error)
- I want to make some basic models and controllers in the "platform" and all the controllers and models from "application" to inherit them
- I want to extend basic core and library classes in the "platform" and if needed they would be extended in the "application"

I don't know if code igniter can already do that or if it needs something to do it.

Basically it's something like the plugins from cakephp (if somebody knows how they are/work).

Question:

How do I do the above?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

似最初 2025-01-11 13:47:06

您可以在“third_party”文件夹中添加您所称的“子应用程序”或应用程序“包”

“应用程序包允许在单个目录中轻松分发完整的资源集,并包含其自己的库、模型、帮助程序、配置和语言文件。建议将这些包放置在应用程序/ Third_party 文件夹...”

来源:
http://codeigniter.com/user_guide/libraries/loader.html (它几乎位于文档的底部。)

这是在应用程序文件夹内完成的。
可能有一种方法可以实现您想要的并将文件夹放在应用程序之外,方法

$this->load->add_package_path(PATH_OUTSIDE_APPLICATIONS.'/my_package/');

是:而不是:

$this->load->add_package_path(APPPATH.'third_party/my_package/');

我还没有测试它是否可以工作。但你可以尝试一下!

There is the "third_party" folder where you can add a "Sub Application" as you call it or a Application "Package".

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

Source:
http://codeigniter.com/user_guide/libraries/loader.html (Its almost down at the bottom of the document.)

This is done inside of the application folder.
There might be a way to achieve what you want and put your folder outside of the application by doing this:

$this->load->add_package_path(PATH_OUTSIDE_APPLICATIONS.'/my_package/');

instead of :

$this->load->add_package_path(APPPATH.'third_party/my_package/');

I haven't tested if it would work yet. But you can try it!

桃扇骨 2025-01-11 13:47:06

您必须对文件进行一些重新调整,但您可以创建两个包含单独应用程序文件的文件夹,然后使用 $application_folder 变量将两个单独的索引文件指向每个文件夹。

我从来没有真正尝试过这个,但它应该有效。确保您还更新了 $system_folder 变量。

更多信息请参见:

http://codeigniter.com/user_guide/general/managing_apps.html

You'll have to do some rejigging of files, but you could create two folders with separate applications files, and then point two separate index files to each folder with the $application_folder variable.

I've never actually tried this, but it should work. Make sure you also update the $system_folder var.

More here:

http://codeigniter.com/user_guide/general/managing_apps.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文