There are three ways to use: 1. "{dede: tag name attribute = 'value'}"; 2. "{dede: tag name attribute = 'value'} {/dede: tag name}"; 3. "{dede:mark name attribute='value'}custom template (InnerText){/dede:mark name}".
#It is very meaningful to understand the knowledge of Dreamweaver template engine. The 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 and 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:mark name attribute='value'}{/dede:mark name}
{dede:tag name attribute='value'}Custom style template (InnerText){/dede:tag name}
Tips:
If you use a tag with an underlying template, you must strictly use the {dede: tag name attribute ='value'}{/dede:mark name} This format, otherwise an error will be reported.
[Arclist tag]
This tag is the most commonly used tag in DedeCms, also called the free list tag, among which hotart, Coolart, likeart, artlist, imglist, imginfolist, specart, and autolist are all alias tags extended by the different attributes defined by this tag.
Function description: Get the specified document list
Scope of application: Cover template, list template, document template
Basic syntax:
{dede:arclist typeid='' row='' col='' titlelen='' infolen='' imgwidth='' imgheight='' listtype='' orderby='' keyword=''}
Underlying template (InnerText){/dede:arclist}
Attribute description:
[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 represent multiple columns separately;
[2] row='' means the total number of document lists returned;
[3] col='' means how many columns to display (default is single column);
[4] titlelen='' means the title length
[5] infolen='' represents the content introduction length;
[6] imgwidth='' represents the thumbnail width;
[7] imgheight='' represents Thumbnail height;
[8] type='' indicates the file type, in which a null value, this attribute is not used, or type='all' is a normal document
§ type='commend ', indicates recommended documents, equivalent to {dede:coolart}{/dede:coolart}
§ type='image', indicates documents that must contain thumbnail images, equivalent to {dede:imglist} {/dede:imglist}、{dede:imginfolist} {/dede:imginfolist}
§ When type='spec', it indicates the topic, which is equivalent to the mark {dede:specart}{/dede:specart}
The above attribute values can be used in combination, such as: type='commend image' indicates recommended image documents
[9] orderby='' indicates the sorting method, the default value is senddate, arranged by release time .
§ orderby='hot' or orderby='click' means sorting by the number of clicks
§ orderby='pubdate' means sorting by publication time (that is, the time value that the front desk allows to change)
§ 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
§ orderby='postnum' Sort by the number of article comments
§ orderby='rand' Randomly obtain a list of documents with specified conditions
[10] orderway='' The value is desc or asc , specifies whether the sorting method is descending order or forward sorting. The default is descending order.
[11] keyword='' represents a list of documents containing specified keywords, multiple keywords are separated by ","
[12] channelid='' represents a specific channel model ID , built-in channels: topic (-1), article (1), photo gallery (2), Flash (4), software (3)
[13] limit='起始,结束' 表示限定的记录范围,row属性必须等于"结束 - 起始",mysql的limit语句是由0起始的,如 “limit 0,5”表示的是取前五笔记录,“limit 5,5”表示由第五笔记录起,取下五笔记录,使用了本属性后,row属性将无效。
[14] att='数值' 表示自定义属性值
[15] subday='天数' 表示在多少天以内的文档,通常用于获取指定天数的热门文档、推荐文档、热门评论文档等
[16] partsort='排列位数' 表示自动获得父栏目的所有子数中排列在第几位的栏目ID,标记为 {dede:autolist}{/dede:autolist} 时,使用本属性才有效。
底层模板字段:
ID(同 id),title,iscommend,color,typeid,ismake,description(同 info),writer,shorttitle,memberid
pubdate,senddate,arcrank,click,litpic(同 picname),typedir,typename,
arcurl(同 filename),typeurl,stime(pubdate 的"0000-00-00"格式),
textlink,typelink,imglink,image
其中:
textlink = title
typelink = typename
image =
字段调用方法:[field:varname/]
如:
{dede:arclist infolen='100'} [field:textlink/] <br> [field:info/] <br> {/dede:arclist}
注:底层模板里的Field实现也是织梦标记的一种形式,因此支持使用PHP语法,Function扩展等功能
如: 给当天发布的内容加上 (new) 标志
[field:senddate runphp='yes'] $ntime = time(); $oneday = 3600 * 24; if(($ntime - @me)<$oneday) @me = "<font color='red'>(new)</font>"; else @me = ""; [/field:senddate]
【Field 标记】
功能说明:用于获取特定栏目或档桉的字段值及常用的环境变量值
适用范围:封面模板、列表模板、文档模板
(1)基本语法
{dede:field name='字段名'/}
(2) 系统分配的field
板块模板:phpurl,indexurl,indexname,templeturl,memberurl,powerby,webname,specurl
列表模板:position,title,phpurl,templeturl,memberurl,powerby,indexurl,indexname,specurl,栏目表dede_arctype的所有字段
其中 position 为 “栏目一 > 栏目二” 这样形式的链接,title则为这种形式的标题
文档模板:position,phpurl,templeturl,memberurl,powerby,indexurl,indexname,specurl,id(同 ID,aid)
(3) 文档所有内容字段
档案dede_archives表 和 附加表的所有字段。
【Channel 标记】
功能说明:用于获取栏目列表
适用范围:封面模板、列表模板、文档模板
(1)基本语法
{dede:channel row='' type=''}
自定义样式模板(InnerText)
{/dede:channel}
(2)属性
[1] row='数字' 表示获取记录的条数(通用在某级栏目太多的时候使用,默认是 8)
[2] type = top,sun/son,self
type='top' 表示顶级栏目
type='son' 或 'sun' 表示下级栏目
type='self' 表示同级栏目
其中后两个属性必须在列表模板中使用。
(3)底层模板变量
ID,typename,typedir,typelink(仅表示栏目的网址)
例:
{dede:channel type='top'} <a href='[field:typelink /]'>[field:typename/]</a> {/dede:channel}
注:在没有指定typeid的情况下,type标记与模板的环境有关,如,模板生成到栏目一,那么type='son'就表示栏目一的所有子类
【Type 标记】别名 onetype
功能说明:表示指定的单个栏目的链接
适用范围:封面模板、列表模板、文档模板
(1)语法
{dede:type typeid=''}{/dede:type}
(2)属性
typeid='栏目ID'
(3)底层模板变量
typename,typelink(仅表示栏目的网址)
【Autochannel 标记】
功能说明:表示指定排序位置的单个栏目的链接
适用范围:封面模板、列表模板、文档模板
(1)语法
{dede:autochannel partsort=''}{/dede:autochannel}
(2)属性
partsort='栏目所在的排序位置'
(3)底层模板变量
typename,typelink(仅表示栏目的网址)
【Mytag 标记】
功能说明:用于获取自定义宏标记的内容
适用范围:封面模板、列表模板、文档模板
(1)基本语法
{dede:mytag typeid='' name='' ismake=''/}
(2)属性
[1] typeid = '数字' 表示栏目ID,默认为 0,在没有设定的栏目没有定义这个名称的标记,会按如下搜索方式来搜索“先向上查找父栏目 -> 通用标记(typeid=0)的同名标记”。
[2] name = '' 标记名称。
[3] ismake = yes|no 默认为 no 表示mytag里的内容不包含其它封面模板的标记,yes则表示标记内容含有其它封面模板标记。
【Vote 标记】
功能说明:用于获取一组投票表单
适用范围:封面模板
(1) 基本语法
{dede:vote id='投票ID' lineheight='22' tablewidth='100%' titlebgcolor='#EDEDE2' titlebackground='' tablebgcolor='#FFFFFF'} {/dede:vote}
注:本标记直接生成投票的HTML表单,为了让你更方便修改其样式,建议在后台->投票管理的地方直接复制生成的HTML代码来使用。
【Flink 标记】,等同 friendlink
功能说明:用于获取友情链接
适用范围:封面模板
(1)基本语法
{dede:flink type='' row='' col='' titlelen='' tablestyle=''}{/dede:flink}
(2)属性
[1]type:链接类型,值:
a. textall 全部用文字显示
b. textimage 文字和图得混合排列
c. text 仅显示不带Logo的链接
d. image 仅显示带Logo的链接
-------------------------------------
[2]row:显示多少行,默认为4行
[3]col:显示多少列,默认为6列
[4]titlelen:站点文字的长度
[5]tablestyle: 表示
The above is the detailed content of How to use the dedecms tag. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version
Visual web development tools

Atom editor mac version download
The most popular open source editor