我正在使用 Zend Framework 中的多网站 CMS。
我已经到了需要从我的网站/应用程序文件夹中的应用程序/文件夹中覆盖模块的地步。
更好地解释我的问题:
这是我的应用程序树(重要部分):
library/
application/
module1/
controllers/
models/
....
module2/
controllers/
models/
....
websites/
website1.com/
application/
module1/
controllers/
models/
....
所以我需要做的是 website/website1.com/application/ 中的 module1/ 覆盖应用程序中的 module1/,如果它存在的话。我希望网站文件夹中 module1/ 中的所有内容都覆盖主应用程序文件夹中的所有内容。
我还想在这个模块 1 中有 2 个控制器(例如 IndexController 和 TestController),如果我只将 TestController 放在模块 1/controllers 下的网站文件夹中,以仅覆盖 Application 文件夹中的 TestController 并从主文件夹中获取 IndexController。
抱歉,如果我未能准确解释我想要达到的目标。如果有不清楚的地方,请询问。
谢谢你。
编辑:
好的,首先 - 感谢您的评论。
拥有网站/文件夹的原因主要是因为 vhost,因为我更喜欢我的所有网站都有单独的(公共?)文件夹,而拥有一个带有应用程序文件夹的库的原因显然是因为升级原因(所以当我例如,升级 Zend - 我不需要为每个网站都升级它)。
我很可能很少对控制器使用覆盖选项,是的,如果我可以扩展主控制器(例如 - IndexController)并覆盖一些功能,我什至更喜欢,但我认为这比覆盖整个班级。
这是我的应用程序的完整结构:
library/ - Library folder contains Zend and many other classes that I'll use in my application.
Zend - Zend Framework
MyCMS - Classes from my old CMS.
sites/ - Folder that contains websties.
website_1 - Website one.
application/ - Application folder for website one. If I need to redefine module or something. So, if I need to override module: main_module, I'll create folder main_module here with files that I want to override.
config/ - Configuration for website_1 - if I need to override, for example, application.ini
lang/ - Language files for this specific website.
templates/ - Templates folder for website (layouts and templates). By the way, I'm using smarty.
default/ - Main template.
layout/ - Layouts for Zend View.
css/
js/
images/
modules/
files/ - Place to upload files in, for this website. This will contain user avatars and stuff.
index.php - Main file that runs bootstrap and application.
Bootstrap.php - Inherited bootstrap. In case I need to override some functions from default bootstrap.
application/ - Main folder that contains application modules and stuff.
main_module/
configs/ - Module configuration.
config.ini
controllers/ - Controllers for this module.
modules/ - Submodules. There are like boxes that I display on website. For example, if my main module is "news", here, I'll make new sub-module to display box with statistics.
submodule/
services/ - XML/JSON/whatever service. If someone targets controller in services with specific parametars, it'll return response in requested format.
controllers/ - Services will only have controllers.
configs/ - Configuration for this submodule.
controllers/ - Controllers for this submodule.
models/ - Models for this submodule.
lang/ - Language files for this submodule.
template/ - Templates for this submodule.
helpers/
css/
js/
images/
index.html
models/ - Models for main module.
lang/
services/ - Main module will also have services. See submodule services for explanation.
controllers/
template/
helpers/
css/
js/
images/
index.html
Bootstrap.php - This is main bootstrap file that every website's bootstrap file will extend (and override some methods - if needed).