Thinkphp Project grouping configuration Method analysis, thinkphp Project _php Tutorial

Source: Internet
Author: User
Tags php template smarty template

Thinkphp Project grouping configuration Method analysis, thinkphp project


This article describes the Thinkphp project grouping configuration method. Share to everyone for your reference, as follows:

Project Grouping Overview

Project grouping is an important mechanism of thinkphp, the project grouping function can merge the former multi-project into a project, for the common file can be reused, but each group 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:

configuration options description example or suggestion
app_group_list project group all names list, if not set, the project grouping mode is not enabled app_group_list ' = ' home,admin,user,blog ',
default_group default project group name, system default is Home Default_group ' = ' Home ',
app_group_depr The separator between item groupings, by default. (point) for a function D function and a delimited recommended default
tmpl_file_depr The partition between the module and the action in the template file, the default is/, only the project group deployment is valid recommended by default, you can use the U method to automatically generate URLs
var_group Gets the item group name variable, by default is G index.php?g=admin&m=index&a=edit, recommended 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.

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

More interested in thinkphp related content readers can view this site topic: "thinkphp Introductory Tutorial", "thinkphp Common Methods Summary", "Smarty Template Primer Basic Tutorial" and "PHP template technology Summary."

It is hoped that this article is helpful to the PHP program design based on thinkphp framework.

Articles you may be interested in:

    • Nginx configuration supports thinkphp's Path_info
    • Configuration example of support thinkphp URL rewrite under Nginx
    • thinkphp How to support yaml configuration file Setup
    • thinkphp Study Notes installation and configuration Chapter
    • thinkphp Configuring Connection Database Tips
    • URL routing rules and configuration instances for thinkphp
    • thinkphp Common configuration files and the configuration file combinations in their respective projects
    • Mapping analysis of common function path and configuration item path in thinkphp
    • thinkphp Custom configuration file
    • Configuring PathInfo mode in Nginx supports thinkphp URL rewriting
    • Modify Apache config file to remove index.php from thinkphp URL
    • Parsing thinkphp Basic Configuration convention.php
    • Summary of common configuration options for thinkphp

http://www.bkjia.com/PHPjc/1113703.html www.bkjia.com true http://www.bkjia.com/PHPjc/1113703.html techarticle thinkphp Project Grouping configuration Method analysis, thinkphp Project This article describes the Thinkphp project group configuration method. Share to everyone for your reference, as follows: Project grouping overview Items ...

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