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

Jul 29, 2016 am 08:36 AM

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.

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1268
29
C# Tutorial
1246
24
PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1? Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1? Apr 17, 2025 am 12:06 AM

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values ​​to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP: A Key Language for Web Development PHP: A Key Language for Web Development Apr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

How does PHP handle file uploads securely? How does PHP handle file uploads securely? Apr 10, 2025 am 09:37 AM

PHP handles file uploads through the $\_FILES variable. The methods to ensure security include: 1. Check upload errors, 2. Verify file type and size, 3. Prevent file overwriting, 4. Move files to a permanent storage location.

How does PHP type hinting work, including scalar types, return types, union types, and nullable types? How does PHP type hinting work, including scalar types, return types, union types, and nullable types? Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP vs. Python: Understanding the Differences PHP vs. Python: Understanding the Differences Apr 11, 2025 am 12:15 AM

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

See all articles