How to specify a single public layouts for a single module, that is, multi-module and multi-layout configuration?

Source: Internet
Author: User
If we want to create a multi-module app, we recommend that you create a folder named modules under the app to store different modules.

If we want to create a multi-module app, we recommend that you create a folder named modules under the app to store different modules.
Create the controllers models views folder under each module.
Including a layouts folder (used to store layout files)

Add in application. ini
Resources. frontController. moduleDirectory = APPLICATION_PATH "/modules"
The purpose is to add a module folder for the front-end controller frontController
You can use this method to load multiple module folders.
Resources. frontController. moduleDirectory [] = APPLICATION_PATH "/modules"
There are also two parameters to be introduced.
Resources. frontController. params. prefixdefamodule module = true;
This is used to determine whether the class name of the module must be prefixed with the module name,
For better differentiation, for example, indexController. php is in the controllers folder of the admin module,
If this parameter is set to false, the class name of the controller class is IndexController.
If it is true, the class name is Admin_IndexController.

Resources. frontController. defaultmodule = "admin"
This parameter specifies the module name to be used by default when no module name is entered.
After adding these parameters, add the module name to the url and you will be able to access them. However, the layouts and layout. phtml in the application root directory are used.
If multiple modules, such as the front module and the admin module, are responsible for front-end display and backend management, the layout they use must be different.

Therefore, you also need to set the layout of each module. We put the layout of each module under the folder of this module.
Make the following settings in application. ini:
Admin. resources. layout. layoutPath = APPLICATION_PATH "/modules/admin/layouts/scripts"
The name of the layout file cannot be renamed by module. each module uses
Resources. layout. layout = The name of layout specified by "layout", which can be modified. if it is modified, all modules of the application will be modified.
After these settings are complete, layout uses
Done

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.