Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the template tag syntax for DedeCMS

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces what is the syntax of DedeCMS template tags. It is very detailed and has a certain reference value. Friends who are interested must read it!

Dream-weaving template tags are similar to XML format. All templates contain delimiters. By default, they are {dede:*} and {/ dede:*}, and "*" represents the template tag name.

In general, {dede:*} and {/ dede:*} appear in pairs, for example:

Example 1-1:

{dede:arclist flag='h' limit='0,1'} [field:title/]

[field:description/]... [view full text]

{/ dede:arclist}

The above {dede:arclist} and {/ dede:arclist} appear in pairs in the template file, and the underlying template (innertext) is included in the two tags.

The underlying template (Innertext), the underlying template is actually for the template output with multiple records, the user manually specifies the style of a single record.

Another form of tags is {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 of the system tags contain the default underlying template. You can check the files under the {cmapath} / templets/system/ folder, which are all the underlying template files of the system.

Annotation

Template annotations for dream-weaving tags are very flexible and can be assigned through the commet attribute behind the tag.

Example 1-3:

{dede:arclist flag='h' limit='0,1' commet=' calls the first content of the headline'} [field:titlecommet= "this is the article title tag" /]

[field:description commet= "this is the summary label" /]. [view full text]

{/ dede:arclist}

When the template engine parses the above tags to html, the content of commet is ignored and not parsed, and users can better understand the meaning of the tags when reading the template tags.

Function

Each dream-weaving tag can be extended with a custom function, which is mainly used to process the output of the current label.

Example 1-4:

{dede: tag name function='youfunction ("parameter one", "parameter two", "@ me")'/}

@ me is used to indicate 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 attribute of the template tag determines the form of the output of the template tag. For example, the main function of the arclist tag is to list documents, but what is listed and how to sort it depends on the attributes of the template tag.

The tag attributes of each template can be found in the template tag description of Weaving Dream.

You can take a look at the flag='h' limit='0,1', in example 1-1, where flag and limit are the relevant attributes of the tag, and you can refer to the introduction of the attributes through the manual.

If the template tag does not list attributes, the system has a default attribute value, and users can refer to the template tag description to view the default attributes.

Programming

One of the convenient places to weave dream templates is to support 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 in-tag programming cannot use statements like echo, and can only pass all return values to @ me.

In addition, because the program code takes up the contents of the underlying template InnerText, the tags that need to be programmed can only use the default InnerText.

The above is all the content of what the DedeCMS template tag syntax is, thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report