国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home Backend Development PHP Tutorial dedecms template dedecms template production and use method

dedecms template dedecms template production and use method

Jul 29, 2016 am 08:36 AM


Overview of parsing engine Template design specification 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. Dreamweaver template parsing engine Overview Before understanding the template code of DedeCms, it is very meaningful to understand the knowledge of the DreamWeaver 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 1", "Parameter 2", "@me") '/}
where @me is used to represent 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")' /}
2. DedeCms template production specifications
  The template of the DedeCms system is not fixed. Users can choose the column template when creating a new column. The official only provides The most basic default template is each template of the built-in system model. DedeCms supports custom channel models. After users customize a new channel model, they need to design a new template according to the model.
1. Concept, design and use of templates, you must understand the following concepts:
1. Section (cover) template:
 Refers to the template used for the website homepage or the cover of more important columns, generally using "index_identification ID.htm "Name. In addition, users can choose whether to support section template tags for individual pages or custom tags individually defined. If supported, the system will use the section template tag engine to parse before outputting the content or generating a specific file.
2. List template:
 Refers to the template of the list of all articles in a certain column of the website, generally named with "list_identification ID.htm".
3. File template:
 Represents the template of the document viewing page, generally named with "article_identification ID.htm".
4. Other templates:
The general system generally includes templates: home page template, search template, RSS, JS compilation function template, etc. In addition, users can also customize a template to create any file.
2. Naming, for the sake of standardization, DreamWeaver officially recommends using a unified way to name templates, as follows:
1. Template saving location:
Template directory: {cmspath/templets/style name (English, the default is default, where system is the underlying template of the system, plus is the template used by the plug-in)/specific function template file}
 General template location: "/templets/default"
2. Template file naming convention:
(1) index_identification ID.htm: Represents the section (column cover) template;
(2) list_identification ID.htm: Represents the column list template;
(3) article_identification ID.htm: Represents the content viewing page (document template, including topic viewing page);
(4) search.htm: Search results list template;
(5) index.htm: Home page template;
Notes:
The [identification IDs] of each content channel in your system are:
Example: list_image.htm means yes, yes The default list template for columns whose content type is picture collection.
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
Scope of application: 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 archive templates. In the cover template, "," is allowed to represent multiple columns separately;
[2] row='' means the number of rows in the returned document. If used in combination with col, the result number is equal to row * col;
[3] col='' means how many columns to display (default is single column);
[4] titlelen=' ' represents the length of the title;
[5] infolen='' represents the length of the content introduction;
[6] imgwidth='' represents the width of the thumbnail;
[7] imgheight='' represents the height of the thumbnail;
[8] type= '' indicates the file type, where the default value or type='all' is an ordinary document.
§ type='commend' indicates a recommended document, which is equivalent to
§ type='image', which indicates that a thumbnail image must be included. Document
[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' sorting by publication time (that is, the time value that the front desk allows to change)
§ orderby='sortrank' sorting by the newness of the article Sorting level sorting (use this attribute if you want to use pinned articles)
§ orderby='id' Sort by article ID
[10] keyword='' represents a list of documents containing specified keywords, multiple keywords use ", "Separate
[11] channelid='number' indicates a specific channel type, built-in channels: topic (-1), article (1), gallery (2), Flash (4), software (3)
[12 ] limit='start, end' indicates a limited record range. The row attribute must be equal to "end - start". MySQL's limit statement starts from 0. For example, "limit 0,5" means taking the first five records. Records, "limit 5,5" means starting from the fifth record, take down five records.
(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 = titletypelink = typename
imglink =
image =
Variable calling method: [field:varname / ]
For example:
{dede:arclist infolen='100'}
[field:textlink /]


[field:info /]


{/dede:arclist}
2. field Tag
This tag is used to obtain the field value and commonly used environment variable value of a specific column or file
Applicable scope: cover template, list template, document template
(1) Basic syntax
{dede:field name=''/}
(2) The value of the name attribute:
Plate template: phpurl,indexurl,indexname,templeturl,memberurl,powerby,webname,specurl
List template: position,title,phpurl,templeturl,memberurl,powerby,indexurl,indexname,specurl, All fields of the column table dede_arctype
where position is a link in the form of "Column One > Column Two", and 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 the archive dede_archives table and additional tables.
3、channel?標(biāo)記
用于獲取欄目列表
適用范圍:封面模板、列表模板、文檔模板
(1)基本語(yǔ)法
{dede:channel?row=''?type=''}
自定義樣式模板(InnerText)
{/dede:channel}
(2)屬性
[1]?row='數(shù)字'?表示獲取記錄的條數(shù)(通用在某級(jí)欄目太多的時(shí)候使用,默認(rèn)是?8)
[2]?type?=?top,sun,self
type='top'?表示頂級(jí)欄目
type='sun'?表示下級(jí)欄目
type='self'?表示同級(jí)欄目
其中后兩個(gè)屬性必須在列表模板中使用。
(3)底層模板變量
ID,typename,typedir,typelink(這里僅表示欄目的網(wǎng)址)
例:
{dede:channel?type='top'}
[field:typename/]?
{/dede:channel}
4、mytag?標(biāo)記
用于獲取自定義標(biāo)記的內(nèi)容
適用范圍:封面模板、列表模板、文檔模板
(1)基本語(yǔ)法
{dede:mytag?typeid=''?name=''?ismake=''?/}
(2)屬性
[1]?typeid?=?'數(shù)字'?表示欄目ID,默認(rèn)為?0,在沒(méi)有設(shè)定的欄目沒(méi)有定義這個(gè)名稱(chēng)的標(biāo)記,會(huì)按如下搜索方式來(lái)搜索“先向上查找父欄目?->?通用標(biāo)記(typeid=0)的同名標(biāo)記”。
[2]?name?=?''?標(biāo)記名稱(chēng)。
[3]?ismake?=?yes|no?默認(rèn)為?no?表示mytag里的內(nèi)容不包含其它封面模板的標(biāo)記,yes則表示標(biāo)記內(nèi)容含有其它封面模板標(biāo)記。
5、vote?標(biāo)記
用于獲取一組投票表單
適用范圍:封面模板
(1)?基本語(yǔ)法
{dede:vote?id='投票ID'?lineheight='22'
tablewidth='100%'?titlebgcolor='#EDEDE2'
titlebackground=''?tablebgcolor='#FFFFFF'}
{/dede:vote}
6、friendlink?標(biāo)記,等同?flink
用于獲取友情鏈接
適用范圍:封面模板
(1)基本語(yǔ)法
{dede:flink?type=''?row=''?col=''?titlelen=''?tablestyle=''}{/dede:flink}
屬性注解:
[1]type:鏈接類(lèi)型,值:
a.?textall?全部用文字顯示
b.?textimage?文字和圖得混合排列
c.?text?僅顯示不帶Logo的鏈接
d.?image?僅顯示帶Logo的鏈接
-------------------------------------
[2]row:顯示多少行,默認(rèn)為4行
[3]col:顯示多少列,默認(rèn)為6列
[4]titlelen:站點(diǎn)文字的長(zhǎng)度
[5]tablestyle:?表示?
7、mynews?標(biāo)記
用于獲取站內(nèi)新聞
適用范圍:封面模板
(1)?基本語(yǔ)法
{dede:mynews?row='條數(shù)'?titlelen='標(biāo)題長(zhǎng)度'}Innertext{/dede:mynews}
Innertext支持的字段為:[field:title?/],[field:writer?/],[field:senddate?/](時(shí)間),[field:body?/]
8、loop?標(biāo)記
用于調(diào)用任意表的數(shù)據(jù),一般用于調(diào)用論壇貼子之類(lèi)的操作,請(qǐng)參閱論壇擴(kuò)展插件。
9、channelartlist?標(biāo)記
用于獲取頻道的下級(jí)欄目的內(nèi)容列表
適用范圍:封面模板
語(yǔ)法:
{dede:channelArtlist?typeid=0?col=2?tablewidth='100%'}








{dede:type}







[field:typename?/]

更多...

{/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 }
mark.
(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 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. pagelist tag
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 x 2
13. Pagebreak tag
Usage: Represents the paged link list of the document.
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}

The above introduces the dedecms template dedecms template production and use methods, including the dedecms template content, 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

Undress AI Tool

Undress AI Tool

Undress images for free

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.

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)

How do I implement authentication and authorization in PHP? How do I implement authentication and authorization in PHP? Jun 20, 2025 am 01:03 AM

TosecurelyhandleauthenticationandauthorizationinPHP,followthesesteps:1.Alwayshashpasswordswithpassword_hash()andverifyusingpassword_verify(),usepreparedstatementstopreventSQLinjection,andstoreuserdatain$_SESSIONafterlogin.2.Implementrole-basedaccessc

How can you handle file uploads securely in PHP? How can you handle file uploads securely in PHP? Jun 19, 2025 am 01:05 AM

To safely handle file uploads in PHP, the core is to verify file types, rename files, and restrict permissions. 1. Use finfo_file() to check the real MIME type, and only specific types such as image/jpeg are allowed; 2. Use uniqid() to generate random file names and store them in non-Web root directory; 3. Limit file size through php.ini and HTML forms, and set directory permissions to 0755; 4. Use ClamAV to scan malware to enhance security. These steps effectively prevent security vulnerabilities and ensure that the file upload process is safe and reliable.

What are the differences between == (loose comparison) and === (strict comparison) in PHP? What are the differences between == (loose comparison) and === (strict comparison) in PHP? Jun 19, 2025 am 01:07 AM

In PHP, the main difference between == and == is the strictness of type checking. ==Type conversion will be performed before comparison, for example, 5=="5" returns true, and ===Request that the value and type are the same before true will be returned, for example, 5==="5" returns false. In usage scenarios, === is more secure and should be used first, and == is only used when type conversion is required.

How can you interact with NoSQL databases (e.g., MongoDB, Redis) from PHP? How can you interact with NoSQL databases (e.g., MongoDB, Redis) from PHP? Jun 19, 2025 am 01:07 AM

Yes, PHP can interact with NoSQL databases like MongoDB and Redis through specific extensions or libraries. First, use the MongoDBPHP driver (installed through PECL or Composer) to create client instances and operate databases and collections, supporting insertion, query, aggregation and other operations; second, use the Predis library or phpredis extension to connect to Redis, perform key-value settings and acquisitions, and recommend phpredis for high-performance scenarios, while Predis is convenient for rapid deployment; both are suitable for production environments and are well-documented.

How do I perform arithmetic operations in PHP ( , -, *, /, %)? How do I perform arithmetic operations in PHP ( , -, *, /, %)? Jun 19, 2025 pm 05:13 PM

The methods of using basic mathematical operations in PHP are as follows: 1. Addition signs support integers and floating-point numbers, and can also be used for variables. String numbers will be automatically converted but not recommended to dependencies; 2. Subtraction signs use - signs, variables are the same, and type conversion is also applicable; 3. Multiplication signs use * signs, which are suitable for numbers and similar strings; 4. Division uses / signs, which need to avoid dividing by zero, and note that the result may be floating-point numbers; 5. Taking the modulus signs can be used to judge odd and even numbers, and when processing negative numbers, the remainder signs are consistent with the dividend. The key to using these operators correctly is to ensure that the data types are clear and the boundary situation is handled well.

How do I stay up-to-date with the latest PHP developments and best practices? How do I stay up-to-date with the latest PHP developments and best practices? Jun 23, 2025 am 12:56 AM

TostaycurrentwithPHPdevelopmentsandbestpractices,followkeynewssourceslikePHP.netandPHPWeekly,engagewithcommunitiesonforumsandconferences,keeptoolingupdatedandgraduallyadoptnewfeatures,andreadorcontributetoopensourceprojects.First,followreliablesource

What is PHP, and why is it used for web development? What is PHP, and why is it used for web development? Jun 23, 2025 am 12:55 AM

PHPbecamepopularforwebdevelopmentduetoitseaseoflearning,seamlessintegrationwithHTML,widespreadhostingsupport,andalargeecosystemincludingframeworkslikeLaravelandCMSplatformslikeWordPress.Itexcelsinhandlingformsubmissions,managingusersessions,interacti

How to set PHP time zone? How to set PHP time zone? Jun 25, 2025 am 01:00 AM

TosettherighttimezoneinPHP,usedate_default_timezone_set()functionatthestartofyourscriptwithavalididentifiersuchas'America/New_York'.1.Usedate_default_timezone_set()beforeanydate/timefunctions.2.Alternatively,configurethephp.inifilebysettingdate.timez

See all articles