If the official template is too abstract, refer:
Parsing engine overview template design specification code reference
Reference: arclist (artlist, likeart, hotart, imglist, imginfolist, coolart, specart) field channel mytag vote friendlink mynews loop channelartlist page list pagelist pagebreak fieldlist
--------------------------------------------------------------------------------
1. Introduction to zhimeng template parsing Engine
Before learning about the template code of DedeCms, it is very meaningful to know about the zhimeng template engine. The zhimeng template engine is a template parser that uses XML Namespaces. The biggest advantage of using the zhimeng parser to parse templates is that you can easily define tag attributes, like using HTML, the template code is very intuitive and flexible. The new zhimeng template engine can not only parse templates, but also analyze error tags in templates.
1. The Code style of the zhimeng template engine is as follows:
{Dede: Tag Name attribute = 'value '/}
{Dede: Tag Name attribute = 'value'} {/dede: Tag name}
{Dede: Tag Name attribute = 'value'} custom style template (InnerText) {/dede: Tag name}
Tip:
For a tag in the form of {dede: Tag Name attribute = 'value'} {/dede: Tag name}, in version 2.1, "{/dede}" is used to end the process,
"{/Dede: Tag name}" must be strictly used in V3; otherwise, an error will be reported.
2. The zhimeng template engine has multiple built-in system tags that can be directly used in any scenario.
(1) The global flag indicates obtaining an external variable. In addition to the Database Password, it can call any configuration parameters of the system in the form:
{Dede: global name = 'variable name'} {/dede: global}
Or
{Dede: global name = 'variable name '/}
The variable name cannot contain the $ symbol. For example, the variable $ inclu_cmspath should be written as {dede: global name = 'cfg _ cmspath '/}.
(2) foreach is used to output an array in the form:
{Dede: foreach array = 'array name'} [field: key/] [field: value/] {/dede: foreach}
(3) include introduces a file in the form:
{Dede: include file = 'file name '/}
The search paths for files are in the absolute path, include folder, CMS installation directory, and CMS main template directory.
3. The woven dream mark allows the function to process the obtained value in any tag, in the form:
{Dede: Tag Name attribute = 'value' function = 'youfunction ("parameter 1", "parameter 2", "@ me ")'/}
@ Me indicates the value of the current tag. Other parameters are determined by your function. For example:
{Dede: field name = 'pubdate' function = 'strftime ("% Y-% m-% d % H: % M: % S", "@ me ") '/}
Ii. DedeCms template creation specifications
1. DedeCms's main template is placed in the "DedeCms installation directory/templets" directory. system is the underlying template, which can be changed in "Custom style template (InnerText, the default folder is the default template officially provided by DedeCms. Because the DedeCms minimum system contains four templates: Gallery, article, Flash, and download. With the templates for topics, searches, and home pages, there are a total of sixteen basic template files, you can change the template as needed.
2. DedeCms template tags are divided into cover template tags (channel cover, home page), list template tags, document template tags, and special purpose tags by function.
Iii. Reference
1. arclist flag
This tag is the most commonly used tag in DedeCms. Among them, hotart, coolart, likeart, artlist, imglist, imginfolist, and specart are all extended by the different attributes defined by this tag.
Purpose: obtain a list of specified documents.
Applicability: Cover templates, list templates, and document templates
(1) Basic Syntax:
{Dede: arclist
Typeid = ''row = ''col = ''titlelen =''
Infolen = ''imgwidth = ''imgheight = ''listtype = ''orderby = ''keyword = ''}
Custom style template (InnerText)
{/Dede: arclist}
This tag is equivalent to artlist, imglist, and imginfolist. It is exactly the same as artlist, and is different from imglist and imginfolist, which are only the default underlying templates.
(2) attribute reference:
[1] typeid = ''indicates the topic ID. You do not need to specify the topic ID in the list template or archive template. You can specify multiple columns separately in the cover template;
[2] row = ''indicates the number of returned documents;
[3] col = ''indicates the number of columns to be displayed (Single Column by default );
[4] titlelen = ''indicates the title length;
[5] infolen = ''indicates the content description length;
[6] imgwidth = ''indicates the width of the thumbnail;
[7] imgheight = ''indicates the height of the thumbnail;
[8] type = ''indicates the file type. The default value or type = 'all' indicates a common document.
§ Type = 'spec 'indicates the topic document, which is equivalent
{Dede: specart typeid = ''row ='' col = ''titlelen ='' infolen =''
Imgwidth = ''imgheight = ''listtype = ''keyword = ''} {/dede: specart}
§ Type = 'commend' indicates the recommendation document, which is equivalent
{Dede: coolart typeid = ''row ='' col = ''titlelen ='' infolen =''
Imgwidth = ''imgheight = ''listtype = ''keyword = ''} {/dede: coolart}
§ Type = 'image' indicates a document that must contain a thumbnail.
§ Type = 'number', specific channel type, 1 Article, 2 image sets, 3 software, 4 Flash, other numbers are the id of the User-Defined channel, that is, the value of dede_channeltype.ID.
[9] orderby = ''indicates the sorting method. The default value is senddate. Property with the same name: sort
§ Orderby = 'hot 'or orderby = 'click' indicates the order. This attribute is equivalent
{Dede: hotart typeid = ''row ='' col = ''titlelen ='' infolen =''
Imgwidth = ''imgheight = ''listtype = ''keyword = ''} {/dede: hotart}
§ Orderby = 'pubdate' is arranged by publishing time (that is, the time value that can be changed at the front end)
§ Orderby = 'sortrank' sort by the new sorting level of the article (use this attribute if you want to use the top article)
§ Orderby = 'id' sort by Article id
[10] keyword = ''indicates the list of documents containing the specified keyword. Separate multiple keywords.
(3) underlying template Variables
ID (same id), title, iscommend, color, typeid, ismake, description (same as info ),
Pubdate, senddate, arcrank, click, litpic (same as picname), typedir, typename,
Arcurl (same as filename), typeurl, stime (pubdate in the "0000-00-00" format ),
Textlink, typelink, imglink, image
Where:
Textlink = title
Typelink = typename
Imglink =
Image =
Variable call method: [field: varname/]
For example:
{Dede: arclist infolen = '000000 '}
[Field: textlink/]
[Field: info/]
{/Dede: arclist}
2. field flag
This tag is used to obtain the field values and common environment variable values of a specific column or category.
Applicability: Cover templates, list templates, and document templates
(1) Basic syntax
{Dede: field name = ''/}
(2) name attribute value:
Plate template: phpurl, indexurl, indexname, templeturl, memberurl, powerby, webname, specurl
List template: position, title, phpurl, templeturl, memberurl, powerby, indexurl, indexname, specurl, all fields in the dede_arctype column table
The position is a link in the form of "column 1> Column 2", and the title is the title in this form.
Document Template: position, phpurl, templeturl, memberurl, powerby, indexurl, indexname, specurl, id (same ID, aid), all fields of the file dede_archives table and the additional table.
3. channel tag
Used to obtain the column list
Applicability: Cover templates, list templates, and document templates
(1) Basic syntax
{Dede: channel row = ''type = ''}
Custom style template (InnerText)
{/Dede: channel}
(2) attributes
[1] row = 'number' indicates the number of records to be retrieved (generally used when there are too many columns at a certain level, the default value is 8)
[2] type = top, sun, self
Type = 'top' indicates top-level Columns
Type = 'sun' indicates a subtopic
Type = 'self 'indicates the same level column
The last two attributes must be used in the list template.
(3) underlying template Variables
ID, typename, typedir, and typelink (only the URL of the topic is shown here)
Example:
{Dede: channel type = 'top '}
[Field: typename/]
{/Dede: channel}
4. mytag tag
Used to obtain the content of a custom tag
Applicability: Cover templates, list templates, and document templates
(1) Basic syntax
{Dede: mytag typeid = ''name ='' ismake = ''/}
(2) attributes
[1] typeid = 'number' indicates the topic ID. The default value is 0. The tag of this name is not defined in the unspecified topic, the following search method is used to search for the "first look up the parent column-> General Mark (typeid = 0) with the same name Mark ".
[2] name = ''indicates the name.
[3] ismake = yes | no by default. no indicates that the content in mytag does not contain tags of other cover templates. yes indicates that the TAG content contains tags of other cover templates.
5. vote mark
Used to obtain a set of voting forms
Applicability: Cover Template
(1) Basic syntax
{Dede: vote id = 'voting id' lineheight = '22'
Tablewidth = '000000' titlebgcolor = '# ede2'
Titlebackground = ''tablebgcolor = '# ffff '}
{/Dede: vote}
6. The friendlink flag is equivalent to the flink
Used to obtain links
Applicability: Cover Template
(1) Basic syntax
{Dede: flink row = ''col ='' titlelen = ''tablestyle =''} {/dede: flink}
7. Mark mynews
Used to obtain news from the website
Applicability: Cover Template
(1) Basic syntax
{Dede: mynews row = 'number of entries 'titlelen = 'title length'} Innertext {/dede: mynews}
Innertext supports the following fields: [field: title/], [field: writer/], [field: senddate/] (time), [field: body/]
8. loop tag
It is used to call data of any table and is generally used to call operations such as Forum posts.
9. channelartlist flag
Used to obtain the content list of lower-level columns of a channel
Applicability: Cover Template
Syntax:
{Dede: channelArtlist typeid = 0 col = 2 tablewidth = '000000 '}
{Dede: type}
[Field: typename/]
More...
{/Dede: type}
{Dede: arclist row = "8 "}
· [Field: title/]
{/Dede: arclist}
{/Dede: channelArtlist}
ChannelArtlist is the only tag that can directly nest other tags, but only for nesting
{Dede: type} {/dede: type} and {dede: arclist} {/dede: arclist}
Mark.
(1) attributes
Typeid = 0 channel ID. By default, the nested tag uses the subtopic of this topic ID. If you want to use a specific topic, you can use ", "Separate multiple IDs.
Col = 2 + Columns
Tablewidth = '000000' size of the peripheral table
10. page tag
Additional Parameters of the paging page
Applicability: list template
Syntax:
{Dede: page pagesize = "number of results per page "/}
11. list tag
List content list in the list template
Syntax:
{Dede: list row = ''col ='' titlelen =''
Infolen = ''imgwidth = ''imgheight = ''orderby = ''} {/dede: list}
Underlying template Variables
ID (same id), title, iscommend, color, typeid, ismake, description (same as info ),
Pubdate, senddate, arcrank, click, litpic (same as picname), typedir, typename,
Arcurl (same as filename), typeurl, stime (pubdate in the "0000-00-00" format ),
Textlink, typelink, imglink, image
12. pagelist flag
Indicates the page number list.
Applicability: list template
Syntax:
{Dede: pagelist listsize = "3 "/}
Listsize indicates the length of [1] [2] [3] items x 2
13. pagebreak flag
Purpose: list the pagination links of a document.
Applicability: Only document templates are supported.
Syntax: {dede: pagebreak /}
14. fieldlist flag
Purpose: obtain information about all fields in the additional table.
Applicability: Only document templates are supported.
Syntax:
{Dede: fieldlist}
[Field: name/]: [field: value/]
{/Dede: fieldlist}
Reproduced in: http://hi.baidu.com/us%5fhosting