thinkphp steps to use the tag library
Application Examples: In the business center management of supply and demand Information page: using the tag library to generate a list;
Step One:
under the project configuration file conf folder, create a new taglibs.php file that will
return Array (
' html ' = ' @ '. Taglib.taglibhtml ',//path format supported using the Import method
);
copy it, which is the definition of which tag library to use in this project;
Step Two:
in the Lib directory, create a new TagLib folder;
lib/taglib/tags/html.xml???????? The definition file of the tag library;
lib/taglib/taglibhtml.class.php. The parsing class of tag library;
Step Three:
copy CommonAction.class.php? Under the action directory;
copy CommonModel.class.php? Under the model directory;
Step Four:
lib/action directory; Create a new class: For example: ProductsAction.class.php
class Productsaction extends Commonaction {
}
if written as:
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;
this place needs to be noted: products must be the table name of the corresponding database;
Step Five:
Create a new products folder in the template;
index.html? need to contain;
the basic JS file;
load Tag Library:
?
{$page}