thinkphp-Two-time development 1

Source: Internet
Author: User

Thinkphp is a more than a Chinese people use a framework, the concrete is not much, do not know can go to Baidu a bit.

Now we are going to talk about how to use the existing semi-finished system to achieve two times development

The two development of thinkphp had to say that his brother Onethink,onethink and thinkphp. The model mechanism and plug-in mechanism provide great convenience to the developers.

1. Understanding the Onethink directory structure

If you haven't learned thinkphp, I suggest you go ahead and learn it. thinkphp is learning two times development, when you learn thinkphp, you will easily find that the expansion of the inside of a addons yes this is the plugin mechanism mentioned earlier, this folder is put plug-in, Plug-ins will also be the focus of learning below.

2. The first plug-in learning in life

1. Learn the plugin configuration in the background

Specifically, you can read this article

Onethink background Add plug-in steps

Let's take one of the Onethink's own plugins as an example

1.config.php (necessary)

Where the title is the key value can be freely configured

Title must be filled

Type must be filled

Tip selected as a hint after title

Options are also configured when type is select

The value at the end is the switch condition at the time of configuration initialization

2. $name. Addons.class.php Necessary

All of the information is required to be displayed on the plugin list.

        Public $info = Array (            ' name ' = ' DevTeam ',            ' title ' = ' Development team information ',            ' description ' = ' Developer team member Information ',            ' Status ' =>1,            ' author ' = ' thinkphp ',            ' version ' = ' 0.1 '        );

 It is particularly important to note that the hook method acquires configuration information by using the function GetConfig to get all the configuration information under the config.php file.

3.widget.html non-essential files if it involves an output template, write it.

It is important to note that {$addons _config.width} Gets the value of the key in the width array, but the value of options passed by key in the options is displayed as a background display configuration.

Now that the first Onethink simple plugin has been completed, I will analyze the system developed by Onethink.

thinkphp-Two-time development 1

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.