Through the above comparison, it seems that ThinkPHP's Custom template tag calls are much simpler than phpcmsv9 labels, but phpcmsv9 features are not flexible and powerful, which requires the participation and improvement of many tper. Summary: The ThinkPHP custom template tag can be called in different templates of the same project, which is convenient and simple, but it only takes some effort to define the tag library. Template tags make website front-end development faster and simpler, which makes the work that should have been done by programmers. Now, only people who know HTM can easily do it, this is the strength of the template tag. Anyone who has been familiar with dedecms, phpcms, and other content management systems knows that the front-end of cms uses template tags to call data, such as lists and content. Let's take a look at the label of the Data ranking list called by phpcms v9:
{pc:content action="hits" catid="6" num="10" order="views DESC"} {loop $data $r}
{$r[title]} {/loop}{/pc}
Note:
The parameter format of the pc braces is:
{Pc: content parameter = "parameter value" parameter name = "parameter value "}
Action: The value of this parameter indicates an operation event. The model PC label must contain this parameter to describe the operation to be performed.
Catid: gets the ID of the channel column and the data of the column.
Num: gets the number of records, and is finally transferred to the processing function by the template engine as limit.
Order: indicates the sorting method of the Data list.
The preceding phpcms template module obtains 10 data records of Columns with ID 6 and sorts the data by clicks.
However, since PHPCMS V9 is already a mature CMS, its template labels are already defined, such as "pc" and "num" tags, we can only read the PHPCMS V9 user documentation to learn how to call it, but cannot change its name. ThinkPHP is just a framework, each developer can use custom template tags to simplify data calling methods.
The following is a ThinkPHP template tag to define such a function:
1. Obtain the number of records, similar to the "num" in phpcms v9 above"
2. Sort data
Preparations: first find a ThinkPHP CMS or blog program without a custom template tag to install it. For ease of instruction, I will use wblog3.1.3