search
HomeCMS TutorialDEDECMSRelated introduction to dedecms template engine

Related introduction to dedecms template engine

Jan 11, 2021 am 10:16 AM
dedecmstemplate engine

Related introduction to dedecms template engine

First of all, let’s introduce the DreamWeaver template engine.

(Learning video sharing: Programming video)

The Dreamweaver template engine is a template parser that uses XML namespace form. Use the Dreamweaver parser to parse templates. The biggest advantage is that you can easily specify the attributes of the tags, which 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:标记名称 属性='值'/}
{dede:标记名称 属性='值'}{/dede:标记名称}
{dede:标记名称 属性='值'}自定义样式模板(InnerText){/dede:标记名称}

Tips:
If you use a tag with an underlying template, you must strictly use {dede: tag name attribute ='value'}{/dede:mark name} This format, 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, indicating to obtain an external variable, in addition to the database password, can call any configuration parameters of the system, in the form:

{dede:global name='变量名称'}{/dede:global}

or

{dede:global name='变量名称'/}

The $ symbol cannot be added to the variable name. For example, the variable $cfg_cmspath should be written as {dede:global name='cfg_cmspath'/}.

(2) foreach is used to output an array, in the form:

{dede:foreach array='数组名称'}[field:key/] [field:value/]{/dede:foreach}

(3) include introduces a file, in the form:

{dede:include file='File name' ismake='Is it a dede plate template (yes/no)'/}
The search path for files is in order: absolute path, include folder, CMS installation directory, CMS main template directory

3. The Dreamweaver tag 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 whether they exist, for example:

{dede:field name='pubdate' function='strftime("%Y-%m-%d %H:%M:%S","@me")'/}

4. The Dreamweaver mark allows limited programming expansion.

The format is:

{dede:tagname runphp='yes'}
$aaa = @me;
@me = "123456";
{/dede:tagname}

@me represents the value of the tag itself. Therefore, statements such as echo cannot be used in programming within the tag. All return values ​​can only be passed to @me.
In addition, since the program code occupies the content of the underlying template InnerText, the tags that require programming can only use the default InnerText.

Related recommendations: dedecms tutorial

The above is the detailed content of Related introduction to dedecms template engine. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:csdn. If there is any infringement, please contact admin@php.cn delete

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

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool