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: