DEDECMS the global markup tutorial used in making Templates _php abstracts

Source: Internet
Author: User
Tags tag name
If this official template explanation looks too abstract, can refer to:












Parsing engine Overview Template Design specification 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
--------------------------------------------------------------------------------
First, dream-weaving template resolution engine overview
Before you know Dedecms's template code, it makes sense to understand the knowledge of a dream template engine. Dream-Weaving template engine is a template parser using the XML namespace form, the biggest benefit of parsing a template with a dream parser is that it makes it easy to make the attributes of the tag, feeling like you're using HTML, making the template code very intuitive and flexible, The new version of the Dream template engine can not only implement the template parsing can also be analyzed in the template error tags.
1, Dream template Engine code style has the following several 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}
Tips:
For {dede: Tag name attribute = ' value '}{/dede: Tag name} This form of markup, in version 2.1, indicates end only needs to use ' {/dede} ', but
"{/dede: Tag name}" is strictly required in V3, otherwise an error will be made.
2. The Dream template engine has multiple system tags built into it, which can be used directly on any occasion.
(1) Global tag, which means to obtain an external variable, which can invoke any configuration parameters of the system in addition to the database password, in the form of:
{dede:global name= ' variable name '} {/dede:global}
Or
{dede:global name= ' variable name '/}
Where the variable name cannot be $ symbol, such as variable $cfg _cmspath, should be written as {Dede:global name= ' Cfg_cmspath '/}.
(2) A foreach is used to output an array in the form of:
{dede:foreach array= ' array name '} [field:key/] [field:value/] {/dede:foreach}
(3) include introduces a file in the form of:
{dede:include file= ' file name '/}
Search paths for files are in order: Absolute path, include folder, CMS installation directory, CMS master template directory
3. Dream Mark allows a function to be used in any tag to process the resulting value in the form of:
{dede: Tag name attribute = ' value ' function= ' youfunction (parameter one, parameter two, @me) '/}
Where @me is used to represent the value of the current tag, and other parameters are determined by your function, such as:
{Dede:field name= ' pubdate ' function= ' strftime ('%y-%m-%d%h:%m:%s ', ' @me ') '/}
Second, Dedecms template production specifications
1, Dedecms's main template is placed in the "Dedecms installation directory/templets" directory, where system is the underlying template, can generally be in the "Custom style template (innertext)" Change, default A folder is the default template that Dedecms officially provides. Because the DEDECMS minimum system contains atlas, articles, Flash, download 4 large templates, plus topics, search and homepage templates, a total of 16 basic template files, you can change the template as needed.
2, dedecms template tag by function: Cover page template tag (channel cover, home page), list template tags, document template tags and special purpose tags.
Third, the main marking reference
1, Arclist Mark
This tag is the most commonly used tag of dedecms, where Hotart, Coolart, Likeart, Artlist, Imglist, Imginfolist, Specart are all extensions of the different attributes defined by this tag.
Function: Gets a list of specified documents
Scope of application: Cover page 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, imginfolist tag, which is exactly equivalent to artlist, unlike the Imglist, Imginfolist is only the default underlying template.
(2) attribute reference:
[1] typeid= ' represents the column ID, in the list template and file template generally do not need to specify, in the cover template allows "," separate multiple columns;
[2] row= ' indicates the number of document bars returned;
[3] col= ' represents the number of columns displayed (default is a single column);
[4] titlelen= ' denotes the length of the title;
[5] infolen= ' represents the length of the description;
[6] imgwidth= ' represents the thumbnail width;
[7] imgheight= ' represents the thumbnail height;
[8] type= ' represents the file type, where the default value or type= ' all ' is the normal document
§type= ' Spec ' when representing a topic document, equates to
{dede:specart typeid= ' row= ' col= ' titlelen= ' infolen= '
Imgwidth= ' imgheight= ' listtype= ' keyword= '}{/dede:specart}
§type= ' commend ', indicating the recommended document, is equivalent to
{dede:coolart typeid= ' row= ' col= ' titlelen= ' infolen= '
Imgwidth= ' imgheight= ' listtype= ' keyword= '}{/dede:coolart}
§type= ' Image ' indicates a document that must contain an abbreviated picture
§type= ' digital ', a specific channel type, 1 articles, 2 picture sets, 3 software, 4 Flash, other numbers are user-defined channel ID, that is, the value of dede_channeltype.id.
[9] orderby= ' means sort by the default value is senddate by publication time. attribute with the same name: sort
§orderby= ' hot ' or orderby= ' click ' means in order, using this property is equivalent to
{dede:hotart typeid= ' row= ' col= ' titlelen= ' infolen= '
Imgwidth= ' imgheight= ' listtype= ' keyword= '}{/dede:hotart}
§orderby= ' pubdate ' by publication time (that is, the time value that the foreground allows to change)
§orderby= ' Sortrank ' sorted by the new sorting level of the article (use this attribute if you want to use a sticky article)
§orderby= ' id ' sorted by article ID
[A] keyword= ' represents a list of documents with the specified keyword, separated by "," for multiple keywords.
(3) Underlying template variables
ID (same ID), title,iscommend,color,typeid,ismake,description (same info),
Pubdate,senddate,arcrank,click,litpic (with Picname), Typedir,typename,
Arcurl (same filename), Typeurl,stime (pubdate "0000-00-00" format),
Textlink,typelink,imglink,image
which
Textlink = Title
Typelink = TypeName
Imglink =
Image =
Variable invocation method: [Field:varname/]
Such as:
{dede:arclist infolen= ' 100 '}
[Field:textlink/]
[Field:info/]
{/dede:arclist}
2. Field Mark
This tag is used to get the field values and commonly used environment variable values for a particular column or file eucalyptus.
Scope of application: Cover page template, list template, document template
(1) Basic grammar
{Dede:field name= '/}
(2) The value of the Name property:
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 column table Dede_arctype
Among them position is "column one > column two" Such form of link, title is this form of title
Document Template: Position,phpurl,templeturl,memberurl,powerby,indexurl,indexname,specurl,id (same id,aid), file Dede_ Archives all fields of the table and attached tables.
3, channel Mark
To get a list of columns
Scope of application: Cover page template, list template, document template
(1) Basic grammar
{dede:channel row= ' type= '}
Custom style template (innertext)
{/dede:channel}
(2) Property
[1] row= ' number ' indicates the number of bars to get records (Universal is used when there are too many columns, default is 8)
[2] type = Top,sun,self
Type= ' Top ' represents the top-level column
Type= ' Sun ' indicates subordinate columns
Type= ' self ' indicates a similar column
The latter two properties must be used in the list template.
(3) Underlying template variables
Id,typename,typedir,typelink (here is only the site of the column)
Cases:
{dede:channel type= ' top '}
[field:typename/]
{/dede:channel}
4, MyTag Mark
To get the contents of a custom tag
Scope of application: Cover page template, list template, document template
(1) Basic grammar
{dede:mytag typeid= ' name= ' ismake= '/}
(2) Property
[1] typeid = ' Number ' indicates the column ID, default is 0, there is not a set in the column does not define the name of the tag, will search the following way to search "first look up the parent column-> Universal tag (typeid=0) of the same name tag."
[2] name = ' ' tag name.
[3] Ismake = yes|no defaults to no means that content in MyTag does not contain tags for other cover page templates, yes indicates that the tag content contains other cover page template tags.
5, Vote Mark
Used to get a set of voting forms
Scope of application: Cover template
(1) Basic grammar
{dede:vote id= ' voting id ' lineheight= ' 22 '
Tablewidth= ' 100% ' titlebgcolor= ' #EDEDE2 '
titlebackground= ' tablebgcolor= ' ' #FFFFFF '}
{/dede:vote}
6, Friendlink mark, equal to Flink
To get Links
Scope of application: Cover template
(1) Basic grammar
{dede:flink row= ' col= ' titlelen= ' tablestyle= '} {/dede:flink}
7, Mynews Mark
For getting news in the station
Scope of application: Cover template
(1) Basic grammar
{dede:mynews row= ' number ' titlelen= ' title length '} Innertext{/dede:mynews}
InnerText supported fields: [Field:title/],[field:writer/],[field:senddate/] (time), [Field:body/]
8. Loop Mark
The data used to invoke any table, typically used to invoke actions such as forum posts.
9, Channelartlist Mark
List of contents used to get the lower section of the channel
Scope of application: Cover template
Grammar:
{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 is limited to nesting
{Dede:type} {/dede:type} and {dede:arclist}{/dede:arclist}
Mark.
(1) Property
Typeid=0 Channel ID, by default, nested tags use the column ID of the subordinate column, if you want to use a specific column, you can use "," separate multiple IDs.
col=2 multiple column display
Size of tablewidth= ' 100% ' perimeter table
10, page Mark
An additional parameter that represents a paginated page
Scope of application: list template
Grammar:
{dede:page pagesize= per page results bar/}
11. List Mark
Represents a list of contents in a list template
Grammar:
{dede:list row= ' col= ' titlelen= '
infolen= ' imgwidth= ' imgheight= ' orderby= '}{/dede:list}
Underlying template variable
ID (same ID), title,iscommend,color,typeid,ismake,description (same info),
Pubdate,senddate,arcrank,click,litpic (with Picname), Typedir,typename,
Arcurl (same filename), Typeurl,stime (pubdate "0000-00-00" format),
Textlink,typelink,imglink,image
12, PageList Mark
Represents a list of paged page numbers
Scope of application: list template
Grammar:
{dede:pagelist listsize= "3"/}
Listsize represents [1][2][3] The length of these items x 2
13, PageBreak Mark
Purpose: Represents a list of pagination links for a document.
Scope of application: Document templates only.
Syntax: {dede:pagebreak/}
14, FieldList Mark
Purpose: Obtain all field information for the attached table.
Scope of application: Document templates only.
Grammar:
{Dede:fieldlist}
[Field:name/]: [Field:value/]
{/dede:fieldlist}

Reproduced in: http://hi.baidu.com/us%5fhosting

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.