thinkphp Project grouping with

Source: Internet
Author: User
thinkphp Project Grouping Configuration

Overview of Project groupings:
Project grouping is an important mechanism of thinkphp, the project grouping function can merge the former multi-projects into a project group, and for the public files can be reused, and each grouping can have its own independent configuration file, public file, language pack, etc.
As an example of an ordinary website, if you do not use a project grouping, then the site foreground (which is provided to the user) is usually used as a project. While the site Management Section, there may be separate configuration files, CSS files and templates, etc., so as another project to manage. But in fact, these two projects are the content of the site, they can share some content such as database configuration files and even some model classes and cross-project operations.
Project grouping is a good solution to the common and individual issues between the projects under the same system.

Project Grouping configuration:
A simple project grouping configuration in the System configuration file (config/config.php) enables grouping of items.
There are five configurations related to the project grouping mode:

Description and examples or recommendations for configuration options:
App_group_list: Project group All names list, if not set means that the project grouping mode is not enabled, for example ' app_group_list ' = ' home,admin,user,blog ',
Default_group: Default project group name, system default is home, for example ' default_group ' = ' home ',
APP_GROUP_DEPR: The separator between item groupings, by default. (point), used for a function D function and delimited in routing configuration, recommended default
TMPL_FILE_DEPR: The partition between the module and the action in the template file, default is/, only valid for Project grouping deployment, suggest default, can use the U method to generate URL automatically
Var_group: Gets the item group name variable, which by default is G, for example Index.php?g=admin&m=index&a=edit, suggests default

When TMPL_FILE_DEPR is configured as _, the corresponding template file is set by the Admin to group the Index module add operation with the original:
Tpl/default/admin/index/add.html
Change to:
Tpl/default/admin/index_add.html
With this configuration, the template directory structure is reduced by one level of directory.
Tip: Tmpl_file_depr is also a delimiter between a language file and a language file in a grouping language definition.
In the above configuration options, to enable grouping, app_group_list must be set, and other options are configured according to the actual situation.

Item Grouping Personality configuration:
If you want to add a separate personalization configuration for the grouped items, you can create a directory with the same name as the project group under configuration directory Conf (the directory naming format is the first letter of the grouping name + lowercase of the remaining letters), and a config.php configuration file is defined within the directory. Personality profiles such as the Admin project:
conf/admin/config.php
When a config.php file is defined in the directory of the grouping name, each time the grouping is accessed, the system automatically loads the separate configuration for the grouping and overrides the settings for the same option in the public configuration.

Zhang Qing (mesh), Weibo: http://t.qq.com/zhangking
From "Mesh Horizon": http://blog.why100000.com
"100,000 Why" computer Learning Network: http://www.why100000.com
2013-4-12

  • 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.