Global tag text tutorial used in dedecms template creation _ PHP Tutorial

Source: Internet
Author: User
The global tag text tutorial used in the dedecms template. If this official template is too abstract, you can refer to: parsing engine overview template design specification code reference tag reference: arclist (artlist, likeart, hotart, imglist if the official template explanation 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

Refer to arclist (artlist, likeart, hotart, imglist...

Related Article

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.