문제

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?

도움이 되었습니까?

해결책

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!

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top