Home >CMS Tutorial >DEDECMS >DedeCMS template tag syntax
Dreamweaver's template tags are similar to XML format. All templates contain delimiters. By default, they are {dede:*} and {/dede:*}. , "*" represents the template tag name.
Generally {dede:*} and {/dede:*} appear in pairs, for example: ##Example 1-1:
{dede:arclist flag='h' limit='0,1'} <h2><a href="[field:arcurl/]">[field:title/]</a></h2> <p>[field:description/]...<a href="[field:arcurl/]">[查看全文]</a></p> {/dede:arclist}The above {dede:arclist} and {/dede:arclist} appear in pairs in the template file and are among the two tags Contains the underlying template (innertext). Underlying template (Innertext), the underlying template is actually a template output for multiple records, and the user manually specifies the style of a single record. The tag also appears in the form {dede:*/}, which usually appears as output variables or content that does not contain the underlying template.
For example: 1-2
{dede:global.cfg_webname/} {dede:arclist flag='h' limit='0,1'/}If the user does not specify the style of a single record, some tags in the system contain default underlying templates. For details, see {cmapath}/ The files under the templets/system/ folder contain the underlying template files of the system.
Comments
The template comments of the Dreamweaver tag are very flexible and can be assigned values through the commet attribute behind the tag.
Example 1-3:
{dede:arclist flag='h' limit='0,1' commet='调用头条的第一篇内容'} <h2><a href="[field:arcurl commet="这是文章链接标签"/]">[field:titlecommet="这是文章标题标签"/]</a></h2> <p>[field:description commet="这是摘要标签"/]...<a href="[field:arcurl commet="这是文章链接标签"/]">[查看全文]</a></p> {/dede:arclist}When the template engine parses the above tags into html, the content of commet is ignored and not parsed. The user You can better understand the meaning of tags when reading template tags.
Function
Each DreamWeaver tag can be expanded using a custom function. The content of the custom function is mainly used to process the output content of the current tag. .
Example 1-4:
{dede:标记名称function='youfunction("参数一","参数二","@me")'/}where @me is used to represent the value of the current tag, and other parameters are determined by your function, for example:
{dede:field.pubdate function='strftime("%Y-%m-%d %H:%M:%S","@me")'/}
Attribute
The attributes of the template tag determine the form of the template tag output. For example, the main function of the arclist tag is to list the document list, but what content is listed? The sorting method depends on the properties of the template tag.
Programming
One of the convenient aspects of Dreamweaver template is that it supports simple template programming.
The format is:
{dede:tagname runphp='yes'} $aaa = @me; @me = "123456"; {/dede:tagname}@me represents the value of the tag itself, so programming within the tag cannot use statements such as echo, and can only return all The value is passed to @me. In addition, because the program code occupies the content of the underlying template InnerText, the tags that need to be programmed can only use the default InnerText.
The above is the detailed content of DedeCMS template tag syntax. For more information, please follow other related articles on the PHP Chinese website!