0

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?

4

2 に答える 2

2

「サードパーティ」フォルダーがあり、「サブアプリケーション」を追加できますApplication "Package"

「アプリケーション パッケージを使用すると、独自のライブラリ、モデル、ヘルパー、構成、および言語ファイルを備えた 1 つのディレクトリ内の完全なリソース セットを簡単に配布できます。これらのパッケージは、application/ 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/');

まだ動作するかどうかはテストしていません。しかし、あなたはそれを試すことができます!

于 2012-02-10T16:29:41.677 に答える