Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将自定义代码添加到';系统&x27;CodeIgniter文件夹?_Codeigniter - Fatal编程技术网

如何将自定义代码添加到';系统&x27;CodeIgniter文件夹?

如何将自定义代码添加到';系统&x27;CodeIgniter文件夹?,codeigniter,Codeigniter,我正在考虑在CodeIgniter之上构建我自己的CMS/扩展框架,我想知道如何构造它以将代码保留在应用程序文件夹之外。我注意到,在典型的CI设置中,文件结构如下所示: application/ //code for your application system/ //CodeIgniter core index.php -system/ //CI core -index.php //manage the front_end requests -ac

我正在考虑在CodeIgniter之上构建我自己的CMS/扩展框架,我想知道如何构造它以将代码保留在
应用程序
文件夹之外。我注意到,在典型的CI设置中,文件结构如下所示:

application/    //code for your application
system/         //CodeIgniter core
index.php
-system/      //CI core
-index.php      //manage the front_end requests
-acp.php      //manage the back_end requests
-apps/      //applications dir
--back_end/      //only "admin" controllers, libraries, config. No views here
--frond_end/      //only "user" controllers, libraries, config. No views here
--acp/      //views for back_end
--themes/      //views for front_end
但是,在中,他们使用了以下结构:

application/    //code for your application 
system/
--cms/          //PyroCMS core
--codeigniter/  //CodeIgniter core.

如何实现类似的结果?

简单的回答是,一切都从index.php开始,这是包含core/CodeIgniter.php的地方,也是设置应用程序和系统路径的地方(从配置中检索值)

我认为pyro cms实际上将/system/cms设置为应用程序文件夹,可能他们编写了代码,查看呈现的应用程序文件夹中的内容并对其进行处理

另一种方法是使用wiredesigns模块化HMVC:

这将允许您将代码分离成模块。只要有一个名为cms的文件夹,其中包含所有cms模块和另一个文件夹,用于在上面构建自定义内容


您可以在配置中设置模块文件夹的路径,因此如果您希望在系统文件夹中设置cms代码,您可以在那里设置模块文件夹的路径,并以标准方式使用codeigniter在顶部构建,可能在加载控制器之前或之后添加钩子以调用cms核心。

要模拟该结构,只需编辑index.php常量:

  • 应用路径
  • 基本路径
@WebWeaver为您提供了一个很好的解决方案,可以使用HMVC改进您的应用程序。我再给你一个

像这样的怎么样:

application/    //code for your application
system/         //CodeIgniter core
index.php
-system/      //CI core
-index.php      //manage the front_end requests
-acp.php      //manage the back_end requests
-apps/      //applications dir
--back_end/      //only "admin" controllers, libraries, config. No views here
--frond_end/      //only "user" controllers, libraries, config. No views here
--acp/      //views for back_end
--themes/      //views for front_end

以上所有内容都可以实现,因为您只需要扩展必要的核心文件。

我的建议只是一个建议,但您可以轻松创建cms并在其上构建自己的cms。 PyroCMS将在下一个版本中弃用codeigniter,这样您就可以保留他们的代码并在需要的地方进行修复,并根据需要进行修改