Home > Backend Development > PHP Tutorial > thinkphp steps to use tag library

thinkphp steps to use tag library

巴扎黑
Release: 2016-11-22 16:12:38
Original
1332 people have browsed it

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

Step 1:
In the project configuration file Conf folder, create a new taglibs.php file and change
return array(
'html' > Folder;
Lib/TagLib/Tags/html.xml The definition file of the tag library;
Lib/TagLib/TagLibHtml.class.php The parsing class of the tag library;

Step 3:
Copy CommonAction.class.php in the Action directory Next;
Copy CommonModel.class.php in the Model directory;

Step 4:
lib/Action directory; create a new class: For example: ProductsAction.class.php

class ProductsAction extends CommonAction {
}
If written:
class FormAction extends CommonAction {
//Filter query fields
function _filter(&$map){
$map['title'] = array('like',"%".$_POST['name']."% ");
}
}
_filter function is used to pass query conditions;

Note here: Products must be the table name of the corresponding database;


Step 5:
Create a new Products folder in the template ;
index.html needs to contain;

Basic JS files;







Load tag library:



{$page}

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template