Step for applying the tag library to thinkphp

Source: Internet
Author: User
How does thinkphp use the tag library? Application example: in the business center? Manage supply and demand information page: use the tag library to generate a list. Step 1: Create a taglibs in the Conf folder of the project configuration file. php file, convert returnarray (html & gt ;@. tagLib. tagLibHtml, using the path format supported by the import method); copy it in. this is the step to define the use of the tag library for this thinkphp project.

? Application example: in the business center? Manage supply and demand information page: generate a list using the tag library;

Step 1:
In the Conf folder of the project configuration file, create a new taglibs. php file
Return array (
'Html' => '@. TagLib. TagLibHtml', // use the path format supported by the import method
);
Copy it in, which defines the tag library used in this project;

Step 2:
Create a new TagLib folder under the Lib directory;
Lib/TagLib/Tags/html. xml ???????? Tag library definition file;
Lib/TagLib/TagLibHtml. class. php? The parsing class of the tag library;

Step 3:
Copy CommonAction. class. php? Under the Action directory;
Copy CommonModel. class. php? Under the Model directory;

Step 4:
In the lib/Action Directory, create a class, for example, ProductsAction. class. php.

Class ProductsAction extends CommonAction {
}
If it is written:
Class FormAction extends CommonAction {
// Filter query fields
Function _ filter (& $ map ){
$ Map ['title'] = array ('like', "%". $ _ POST ['name']. "% ");
}
}
_ The filter function is used to pass query conditions;

Note that Products must be the table name of the corresponding database;


Step 5:
Create a new Products folder in the template;
Index.html? Need to include;

Basic JS files;






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.