Home > Backend Development > PHP Tutorial > power by dedecms dedecms graphic tutorial on global markers used in making templates

power by dedecms dedecms graphic tutorial on global markers used in making templates

WBOY
Release: 2016-07-29 08:36:30
Original
1630 people have browsed it
If this official template explanation seems too abstract, you can refer to:
 dedecms 制作模板中使用的全局标记图文教程
 dedecms 制作模板中使用的全局标记图文教程
 dedecms 制作模板中使用的全局标记图文教程
 dedecms 制作模板中使用的全局标记图文教程
Parsing engine overview Template design specifications Code reference
Mark 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, it is very meaningful to understand the knowledge of the DedeCms template engine. 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}
Tips:
For the form {dede: tag name attribute = 'value'} {/dede: tag name} In version 2.1, you only need to use "{/dede}" to indicate the end, but in
V3, you need to strictly use "{/dede:mark name}", otherwise an error will be reported.
2. The Dreamweaver template engine has multiple built-in system tags, and these system tags can be used directly in any situation.
(1) 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 introduction 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. Dreamweaver mark 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, and other parameters are determined by your function. 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. Generally, it can 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, and specart are all extended by different attributes defined by this tag. of.
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 artlist, imglist, The imginfolist tag is completely identical to artlist, and is only different from imglist and imginfolist 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 separately represent multiple columns;
[2] row='' means the number of documents returned;
[3] col='' means how many columns to display (default is single column);
[4] titlelen='' means the title length;
[5] infolen='' means Content introduction length;
[6] imgwidth='' indicates thumbnail width;
[7] imgheight='' indicates thumbnail height;
[8] type='' indicates file type, where the default value or type='all ' is an ordinary document
§ When type='spec', it means a special document, which is equivalent to
{dede:specart typeid='' row='' col='' titlelen='' infolen=''
imgwidth='' imgheight='' listtype='' keyword=''}{/dede:specart}
§ type='commend' indicates recommended documents, which is equivalent to
{dede:coolart typeid='' row='' col=' ' titlelen='' infolen=''
imgwidth='' imgheight='' listtype='' keyword=''}{/dede:coolart}
§ When type='image', it means that the document must contain thumbnail images
§ type='number', specific channel type, 1 article, 2 photo album, 3 software, 4 Flash, other numbers are user-defined channel id, 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' arranged by publication time (that is, the time value allowed to be changed by the front desk)
§ orderby='sortrank' Sort by the new sorting level of the article (use this attribute if you want to use pinned articles)
§ orderby='id' Sort by article ID
[10] keyword='' indicates documents containing the specified keyword List, multiple keywords are separated by ",".
(3) Bottom template variables
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
where:
textlink = title
typelink = typename
imglink =
image =
variable call Method: [field:varname /]
For example:
{dede:arclist infolen='100'}
[field:textlink /]
[field:info /]
{/dede:arclist}
2. Field mark
this Tags are used to obtain field values ​​of specific columns or files and commonly used environment variable values ​​
Applicable scope: cover templates, list templates, document templates
(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, column table dede_arctype All fields
where position is a link in the form of "Column One > Column Two", 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 archive dede_archives table and additional tables.
3. Channel tag
is used to get the column list
Applicable scope: cover template, list template, document template
(1) Basic syntax
{dede:channel row='' type=''}
Custom style template (InnerText )
{/dede:channel}
(2) Attributes
[1] row='number' indicates the number of records obtained (generally used when there are too many columns at a certain level, the default is 8)
[2] type = top, sun, self
type='top' means top-level column
type='sun' means lower-level column
type='self' means same-level column
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
Applicable scope: cover template, list template, document template
(1) Basic syntax
{dede:mytag typeid='' name='' ismake='' /}
(2) Attribute
[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 search method will be as follows: "Look up the parent column first. -> Tag with the same name as the universal tag (typeid=0)".
[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
Applicable scope: cover template
(1) Basic syntax
{dede:vote id='voting ID' line style="max-width:90%"
tablewidth='100%' titlebgcolor= '#EDEDE2'
titlebackground='' tablebgcolor='#FFFFFF'}
{/dede:vote}
6. Friendlink tag, equivalent to flink
Used to obtain friendly links
Scope of application: cover template
(1) Basic syntax
{dede:flink row='' col='' titlelen='' tablestyle=''}{/dede:flink}
7. Mynews tag
is used to obtain news on the site
Scope of application: cover template
(1) Basic syntax
{dede:mynews row='Number of articles' titlelen='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 to call operations such as forum posts.
9. channelartlist tag
is used to obtain the content list of the lower-level 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 directly nest other tags, but it is limited to nesting
{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 IDs.
col=2 Display in multiple columns
tablewidth='100%' The size of the peripheral table
10. Page tag
Indicates additional parameters of the paging page
Applicable scope: list template
Syntax:
{dede:page pagesize="per page Number of results "/}
11. The list mark
represents the content list in the list template
Syntax:
{dede:list row='' col='' titlelen=''
infolen='' imgwidth='' imgheight= ''orderby=''}{/dede:list}
Underlying template variables
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. The pagelist mark
represents a paging page number list
Scope of application: list template
Syntax:
{dede:pagelist listsize="3"/}
listsize means [1][2][3] The length of these items Paginated list of links.
Scope of application: only document templates.
Syntax: {dede:pagebreak /}
14. fieldlist tag
Purpose: Get all field information of the attached table.
Scope of application: only document templates.
Syntax:
{dede:fieldlist}
[field:name /]: [field:value /]
{/dede:fieldlist}


Reprinted at: http://hi.baidu.com/us%5fhosting The above introduces the global markup graphic tutorial used in power by dedecms dedecms template production, including the content of power by dedecms. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template