Dedecms Tutorial _php Tutorial for using global markup graphics in production templates

Source: Internet
Author: User
If this official template explanation looks too abstract, you 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
--------------------------------------------------------------------------------
I. Weaving dream template parsing engine overview
Before you know the template code for DEDECMS, it makes sense to know the knowledge of the dream templating engine. Weaving dream template engine is a template parser using XML namespace form, the biggest advantage of using the Dream Parser parsing template is that it can easily make the attributes of the tag, it feels like HTML, so that the template code is very intuitive and flexible, The new version of the Weaving Dream template engine not only enables the parsing of templates but also analyzes the errors in the template.
1, Weaving Dream template Engine Code style has 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}
Tips:
For {dede: Tag name attribute = ' value '}{/dede: Tag name} This form of markup, in version 2.1, indicates that the end requires only "{/dede}", but
V3 need to strictly use "{/dede: Tag name}", otherwise it will be an error.
2, weaving Dream template engine built-in multiple system tags, these system markings can be used in any situation directly.
(1) Global tag, which means to get an external variable, in addition to the database password, can invoke any configuration parameters of the system, in the form of:
{dede:global name= ' variable name '} {/dede:global}
Or
{dede:global name= ' variable name '/}
Where variable names cannot be added to the $ symbol, such as variables $cfg _cmspath, should be written as {Dede:global name= ' Cfg_cmspath '/}.
(2) 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 '/}
The search path to the file is in order: Absolute path, include folder, CMS installation directory, CMS master template directory
3. The dream tag allows a function to be used in any tag to process the resulting 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 for existence, for example:
{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 changed in the "Custom style template (InnerText)", default The folder is the default template that Dedecms officially provides. Because the Dedecms smallest system contains atlas, articles, Flash, download 4 large templates, plus the theme, search and home page templates, there are 16 basic template files, you can change the template as you want.
2. Dedecms template tags are categorized by function: Cover page template tags (channel cover, home page), list template tags, document template tags, and special purpose tags.
Third, the main marker reference
1. Arclist Mark
This tag is the most commonly used marker for dedecms, where Hotart, Coolart, Likeart, Artlist, Imglist, Imginfolist, and Specart are all extended by the different attributes defined by the 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 templates (InnerText)
{/dede:arclist}
This tag is equivalent to the artlist, imglist, imginfolist tags, which are exactly the same as artlist, unlike Imglist and Imginfolist, which are only the default underlying templates.
(2) attribute reference:
[1] typeid= "indicates the column ID, in the list template and profile template generally do not need to specify, in the cover template allows", "separate representation of multiple columns;
[2] row= "indicates the number of documents returned;
[3] col= ' indicates how many columns are displayed (default is single column);
[4] titlelen= ' indicates the title length;
[5] infolen= "indicates the length of the content introduction;
[6] imgwidth= "indicates the width of the thumbnail image;
[7] imgheight= "indicates the height of the thumbnail image;
[8] type= "indicates the file type, where the default value or type= ' all ' is a normal document
§type= ' Spec ', which represents a feature document, is equivalent to
{dede:specart typeid= ' row= ' col= ' titlelen= ' infolen= '
Imgwidth= ' imgheight= ' listtype= ' keyword= '}{/dede:specart}
§type= ' commend ' indicates the recommended document, equivalent to
{dede:coolart typeid= ' row= ' col= ' titlelen= ' infolen= '
Imgwidth= ' imgheight= ' listtype= ' keyword= '}{/dede:coolart}
§type= ' Image ' indicates a document that must contain a thumbnail image
§type= ' numbers ', specific channel types, 1 articles, 2 picture sets, 3 software, 4 Flash, other numbers is the ID of the user-defined channel, which is the value of dede_channeltype.id.
[9] orderby= ' indicates the Sort method, the default value is senddate by release time. Property 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 ' is sorted by the new sort level of the article (use this property if you want to use a pinned article)
§orderby= ' id ' sorted by article ID
[keyword=] Indicates a list of documents containing the specified keywords, with multiple keywords separated by ",".
(3) Underlying template variable
ID (same ID), title,iscommend,color,typeid,ismake,description (same as info),
Pubdate,senddate,arcrank,click,litpic (with Picname), Typedir,typename,
Arcurl (same as 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 obtain the field value of a particular column or file and the values of the environment variables used.
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 of column table Dede_arctype
Which position for "column one > column two" such a form of link, title is the title of this form
Document Template: Position,phpurl,templeturl,memberurl,powerby,indexurl,indexname,specurl,id (with Id,aid), archive Dede_ Archives all fields of the table and attached tables.
3. Channel marking
Used 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 templates (InnerText)
{/dede:channel}
(2) Properties
[1] row= ' number ' indicates the number of entries to get the record (common use when there are too many columns in a certain level, default is 8)
[2] type = Top,sun,self
Type= ' top ' denotes top column
Type= ' Sun ' indicates a subordinate column
Type= ' self ' indicates a peer column
The latter two properties must be used in the list template.
(3) Underlying template variable
Id,typename,typedir,typelink (this is only the URL of the column)
Cases:
{dede:channel type= ' top '}
[field:typename/]
{/dede:channel}
4. MyTag Mark
Used 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) Properties
[1] typeid = ' Number ' indicates the column ID, the default is 0, in the column does not have a definition of the name of the tag, the search method as follows to search for "first up to find the parent column, universal tag (typeid=0) The same name tag".
[2] name = ' Tag '.
[3] Ismake = yes|no default to no means that the contents of MyTag do not contain other cover page template tags, 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= ' poll id ' lineheight= ' 22 '
Tablewidth= ' 100% ' titlebgcolor= ' #EDEDE2 '
Titlebackground= ' tablebgcolor= ' #FFFFFF '}
{/dede:vote}
6, Friendlink mark, equivalent to Flink
Used to get links
Scope of application: Cover template
(1) Basic grammar
{dede:flink row= ' col= ' titlelen= ' tablestyle= '} {/dede:flink}
7. Mynews Mark
Used to get news on the site
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 content used to get the sub-columns 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 nest other tags directly, but is limited to nesting
{Dede:type} {/dede:type} and {dede:arclist}{/dede:arclist}
Mark.
(1) Properties
Typeid=0 Channel ID, by default, nested tags use the column ID of the sub-column, if you want to use a specific column, you can use "," separate multiple IDs.
col=2 Display of multiple columns
Tablewidth= ' 100% ' Peripheral table size
10. Page Tag
Additional parameters that represent the paging page
Scope of application: list template
Grammar:
{dede:page pagesize= "number of result bars per page"/}
11. List tag
Represents a list of content 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 as info),
Pubdate,senddate,arcrank,click,litpic (with Picname), Typedir,typename,
Arcurl (same as filename), Typeurl,stime (pubdate "0000-00-00" format),
Textlink,typelink,imglink,image
12. PageList Mark
Represents a paginated page number list
Scope of application: list template
Grammar:
{dede:pagelist listsize= "3"/}
Listsize = [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: Gets all the 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

http://www.bkjia.com/PHPjc/318020.html www.bkjia.com true http://www.bkjia.com/PHPjc/318020.html techarticle 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 ...

  • 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.