If this official template explanation seems too abstract, you can refer to:
Parsing engine overview Template design specifications Code reference
tag reference: arclist(artlist,likeart,hotart,imglist,imginfolist,coolart,specart) field channel mytag vote friendlink mynews loop channelartlist page list pagelist pagebreak fieldlist
------- -------------------------------------------------- -----------------------
1. Overview of the DedeCms template parsing engine
Before understanding the template code of DedeCms, learn about the DedeCms template. Knowledge of the engine is very meaningful. The Dreamweaver template engine is a template parser that uses XML namespaces. The biggest advantage of using the Dreamweaver parser to parse templates is that you can easily specify the attributes of the tag. It feels like using HTML, making the template code very intuitive. Flexible, the new version of the Dreamweaver template engine can not only parse the template but also analyze the wrong tags in the template.
1. The code styles of the Dreamweaver template engine have the following forms:
{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 {dede:Tag name attribute='value '}{/dede:mark name}, in version 2.1, only needs to use "{/dede}" to indicate the end, but in
V3, "{/dede:mark name}" needs to be strictly used. , otherwise an error will be reported.
2. The Dreamweaver template engine has multiple built-in system tags, which can be used directly in any situation.
(1) The global tag means to obtain an external variable. In addition to the database password, it can call any configuration parameters of the system. The form is:
{dede:global name='variable name'}{/dede: global}
or
{dede:global name='variable name' /}
The variable name cannot be added with the $ symbol, such as the variable $cfg_cmspath, which 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 path for the file is in the order: absolute path, include folder, CMS installation directory, CMS main template directory
3. The Dreamweaver tag allows the use of functions in any tag to process the obtained value, in the form:
{dede: tag name attribute='value' function='youfunction("parameter One","Parameter two","@me")'/}
where @me is used to represent the value of the current tag, other parameters are determined by your function whether they exist, for example:
{dede:field name='pubdate' function='strftime("%Y-%m-%d %H:%M:%S","@me")' /}
2. DedeCms template production specifications
1 , The main template of DedeCms is placed in the "DedeCms installation directory/templets" directory, where system is the underlying template, which can generally be changed in "Custom style template (InnerText)". The default folder is the default template officially provided by DedeCms. Because the minimum system of DedeCms includes 4 large templates, including albums, articles, Flash, and downloads, plus topic, search, and homepage templates, there are a total of sixteen basic template files. You can change the templates you need according to your own situation.
2. The template tags of DedeCms are divided by function into: cover template tags (channel cover, home page), list template tags, document template tags and special purpose tags.
3. Main tag reference
1. arclist tag
This tag is the most commonly used tag in DedeCms. Among them, hotart, coolart, likeart, artlist, imglist, imginfolist, specart are all represented by this tag. Extended from different attributes defined.
Function: Get a specified document list
Applicable scope: cover template, list template, document template
(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 the artlist, imglist, and imginfolist tags. It is completely equivalent to artlist, and is different from imglist and imginfolist only in the default underlying template.
(2) Attribute reference:
[1] typeid='' represents the column ID, which generally does not need to be specified in list templates and file templates. In the cover template, "," is allowed to be used to represent multiple columns separately;
[2] row='' indicates the number of documents returned;
[3] col='' indicates how many columns to display (default is single column);
[4] titlelen='' indicates the length of the title ;
[5] infolen='' indicates the length of the content introduction;
[6] imgwidth='' indicates the thumbnail width;
[7] imgheight='' indicates the thumbnail height;
[ 8] type='' represents the file type, where the default value or type='all' is a normal document
§ type='spec' represents a special document, which is equivalent to
{dede:specart typeid=' ' row='' col='' titlelen='' infolen=''
imgwidth='' imgheight='' listtype='' keyword=''}{/dede:specart}
§ type=' Commend' means recommended documents, which is equivalent to
{dede:coolart typeid='' row='' col='' titlelen='' infolen=''
imgwidth='' imgheight='' listtype= ''keyword=''}{/dede:coolart}
§ type='image', indicates that the document must contain thumbnail images
§ type='number', specific channel type, 1 article, 2 picture album, 3 software, 4 Flash, the other numbers are the id of the user-defined channel, which is the value of dede_channeltype.ID.
[9] orderby='' indicates the sorting method. The default value is senddate arranged by release time. Attributes with the same name: sort
§ orderby='hot' or orderby='click' means sorting in order. Using this attribute is equivalent to
{dede:hotart typeid='' row='' col='' titlelen ='' infolen=''
imgwidth='' imgheight='' listtype='' keyword=''}{/dede:hotart}
§ orderby='pubdate' Sort by publication time (that is, the front desk Time value that is allowed to change)
§ orderby='sortrank' Sort by the new sort level of the article (use this attribute if you want to use pinned articles)
§ orderby='id' Sort by article ID
[10] keyword='' indicates a list of documents containing the specified keyword. Multiple keywords are separated by ",".
(3) Bottom template variables
ID (same as id), title, isommend, color, typeid, ismake, description (same as info),
pubdate, senddate, arcrank, click, litpic (same as picname) ,typedir,typename,
arcurl (same as filename),typeurl,stime (pubdate's "0000-00-00" format),
textlink,typelink,imglink,image
where:
textlink = title
typelink = typename
imglink =
image =
Variable calling method: [field:varname /]
For example:
{dede:arclist infolen='100'}
[field:textlink /]
[field:info /]
{/dede:arclist}
2. Field tag
This tag is used to obtain the field value and commonly used fields of a specific column or file. The environment variable value
Applicable scope: cover template, list template, document template
(1) Basic syntax
{dede:field name=''/}
(2) The value of the name attribute:
Section template: phpurl, indexurl, indexname, templeturl, memberurl, powerby, webname, specurl
List template: position, title, phpurl, templeturl, memberurl, powerby, indexurl, indexname, specurl, all of the column table dede_arctype Field
where position is a link in the form of "Column One > Column Two", and title is a title in this form
Document template: position,phpurl,templeturl,memberurl,powerby,indexurl,indexname,specurl, id (same as ID, aid), all fields of the archive dede_archives table and additional tables.
3. The channel tag
is used to obtain the column list
Scope of application: cover template, list template, document template
(1) Basic syntax
{dede:channel row='' type= ''}
Custom style template (InnerText)
{/dede:channel}
(2) Attribute
[1] row='number' indicates the number of records to obtain (generally used in a certain Used when there are too many level columns, the default is 8)
[2] type = top,sun,self
type='top' means top-level columns
type='sun' means lower-level columns
type='self' means the same level column
where the last two attributes must be used in the list template.
(3) Bottom template variables
ID, typename, typedir, typelink (here only represents the URL of the column)
Example:
{dede:channel type='top'}
[field :typename/]
{/dede:channel}
4. Mytag tag
is used to obtain the content of custom tags
Scope of application: cover template, list template, document template
(1 )Basic syntax
{dede:mytag typeid='' name='' ismake='' /}
(2) Attributes
[1] typeid = 'number' represents the column ID, the default is 0, If there is no tag with this name defined in the unset column, the following search method will be used to search "first search up the parent column -> universal tag (typeid=0) for the tag with the same name".
[2] name = '' tag name.
[3] ismake = yes|no The default is no, which means that the content in mytag does not contain other cover template tags, yes means that the tag content contains other cover template tags.
5. vote tag
is used to obtain a set of voting forms
Scope of application: cover template
(1) Basic syntax
{dede:vote id='vote ID' lineheight='22 '
tablewidth='100%' titlebgcolor='#EDEDE2'
titlebackground='' tablebgcolor='#FFFFFF'}
{/dede:vote}
6. friendlink tag, equivalent to flink
Used to obtain friendly links
Applicable scope: cover template
(1) Basic syntax
{dede:flink row='' col='' titlelen='' tablestyle=''}{/dede ; Title length'}Innertext{/dede:mynews}
The fields supported by Innertext are: [field:title /], [field:writer /], [field:senddate /] (time), [field:body /]
8. The loop tag
is used to call data from any table, and is generally used for operations such as calling forum posts.
9. The channelartlist tag
is used to obtain the content list of the lower-level columns of the channel
Scope of application: cover template
Syntax:
{dede:channelArtlist typeid=0 col=2 tablewidth='100 %'}
{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 Nested
{dede:type}{/dede:type} and {dede:arclist}{/dede:arclist}
tags.
(1) Attribute
typeid=0 channel ID. By default, the nested tag uses the subordinate column of this column ID. If you want to use a specific column, you can use "," to separate multiple columns. ID.
col=2 Display in multiple columns
tablewidth='100%' The size of the peripheral table
10. The page tag
indicates the additional parameters of the paging page
Applicable scope: list template
Syntax:
{dede:page pagesize="Number of results per page"/}
11. The list tag
represents the content list in the list template
Syntax:
{dede:list row ='' col='' titlelen=''
infolen='' imgwidth='' imgheight='' orderby=''}{/dede:list}
Underlying template variable
ID (same as 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's "0000-00-00" format),
textlink, typelink, imglink, image
12. pagelist tag
represents a paginated page number list
Scope of application: list template
syntax :
{dede:pagelist listsize="3"/}
listsize means [1][2][3] The length of these items x 2
13. Pagebreak tag
Purpose: Indicates the length of the document Paginated list of links.
Applicable scope: document template only.
Syntax: {dede:pagebreak /}
14. Fieldlist tag
Purpose: Get all field information of the attached table.
Applicable scope: document template only.
Syntax:
{dede:fieldlist}
[field:name /]: [field:value /]
{/dede:fieldlist}
Reprinted at: http://hi.baidu.com/us%5fhosting
http://www.bkjia.com/PHPjc/318020.html
www.bkjia.com
truehttp: //www.bkjia.com/PHPjc/318020.htmlTechArticleIf this official template explanation seems too abstract, you can refer to: Parsing Engine Overview Template Design Specification Code Reference Tag reference: arclist(artlist,likeart,hotart,imglist...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn