Home php教程 php手册 dedecms模板标签代码官方参考

dedecms模板标签代码官方参考

Jun 13, 2016 pm 12:32 PM
dedecms diy http code Can address official Label template

没想到dedecms可以这样DIY,牛啊

地址:http://www.dedecms.com/archives/templethelp/help/
在了解DedeCms的模板代码之前,了解一下织梦模板引擎的知识是非常有意义的。织梦模板引擎是一种使用XML名字空间形式的模板解析器,使用织梦解析器解析模板的最大好处是可以轻松的制定标记的属性,感觉上就像在用HTML一样,使模板代码十分直观灵活,新版的织梦模板引擎不单能实现模板的解析还能分析模板里错误的标记。

1、织梦模板引擎的代码样式有如下几种形式:
{dede:标记名称 属性='值'/}
{dede:标记名称 属性='值'}{/dede:标记名称}
{dede:标记名称 属性='值'}自定义样式模板(InnerText){/dede:标记名称}

提示:
如果使用带底层模板的标记,必须严格用{dede:标记名称 属性='值'}{/dede:标记名称} 这种格式,否则会报错。

2、织梦模板引擎内置有多个系统标记,这些系统标记在任何场合都是能直接使用的。

(1) global 标记,表示获取一个外部变量,除了数据库密码之外,能调用系统的任何配置参数,形式为:
{dede:global name='变量名称'}{/dede:global}

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

其中变量名称不能加 $ 符号,如变量 $cfg_cmspath ,应该写成 {dede:global name='cfg_cmspath'/} 。

(2) foreach 用来输出一个数组,形式为:
{dede:foreach array='数组名称'}[field:key/] [field:value/]{/dede:foreach}

(3) include 引入一个文件,形式为:
{dede:include file='文件名称' ismake='是否为dede板块模板(yes/no)'/}
对文件的搜索路径为顺序为:绝对路径、include文件夹,CMS安装目录,CMS主模板目录

3、织梦标记允许在任何标记中使用函数对得到的值进行处理,形式为:
{dede:标记名称 属性='值' function='youfunction("参数一","参数二","@me")'/}
其中 @me 用于表示当前标记的值,其它参数由你的函数决定是否存在,例如:
{dede:field name='pubdate' function='strftime("%Y-%m-%d %H:%M:%S","@me")'/}

4、织梦标记允许有限的编程扩展。
格式为:
{dede:tagname runphp='yes'}
$aaa = @me;
@me = "123456";
{/dede:tagname} 
@me 表示这个标记本身的值,因此标记内编程是不能使用echo之类的语句的,只能把所有返回值传递给@me。
此外由于程序代码占用了底层模板InnerText的内容,因此需编程的标记只能使用默认的InnerText。

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)

Update | Hacker explains how to install Epic Games Store and Fortnite on iPad outside the EU Update | Hacker explains how to install Epic Games Store and Fortnite on iPad outside the EU Aug 18, 2024 am 06:34 AM

Update: Saunders Tech has uploaded a tutorial to his YouTube channel (video embedded below) explaining how to install Fortnite and the Epic Games Store on an iPad outside the EU. However, not only does the process require specific beta versions of iO

How to use Copilot to generate code How to use Copilot to generate code Mar 23, 2024 am 10:41 AM

As a programmer, I get excited about tools that simplify the coding experience. With the help of artificial intelligence tools, we can generate demo code and make necessary modifications as per the requirement. The newly introduced Copilot tool in Visual Studio Code allows us to create AI-generated code with natural language chat interactions. By explaining functionality, we can better understand the meaning of existing code. How to use Copilot to generate code? To get started, we first need to get the latest PowerPlatformTools extension. To achieve this, you need to go to the extension page, search for "PowerPlatformTool" and click the Install button

How to check the MAC address on a mobile phone (simple operation allows you to easily obtain the MAC address of the device) How to check the MAC address on a mobile phone (simple operation allows you to easily obtain the MAC address of the device) Apr 19, 2024 pm 06:19 PM

We may need to check the MAC address of the mobile phone in some specific situations, such as setting up wireless network filtering or device management. This article will teach you how to easily obtain the MAC address of your device through your mobile phone. 1. What is a MAC address 2. Mobile phone system: Android and iOS 3. How to check the MAC address in the Android system 4. How to check the MAC address in the iOS system 5. Use the device management application to check the MAC address 6. Check the connected devices through the wireless router 7. View the MAC address through a third-party application 8. View the MAC address through the developer options in the phone settings 9. View the MAC address using a network analysis tool 10. View the MAC address through the command line

Tsinghua University and Zhipu AI open source GLM-4: launching a new revolution in natural language processing Tsinghua University and Zhipu AI open source GLM-4: launching a new revolution in natural language processing Jun 12, 2024 pm 08:38 PM

Since the launch of ChatGLM-6B on March 14, 2023, the GLM series models have received widespread attention and recognition. Especially after ChatGLM3-6B was open sourced, developers are full of expectations for the fourth-generation model launched by Zhipu AI. This expectation has finally been fully satisfied with the release of GLM-4-9B. The birth of GLM-4-9B In order to give small models (10B and below) more powerful capabilities, the GLM technical team launched this new fourth-generation GLM series open source model: GLM-4-9B after nearly half a year of exploration. This model greatly compresses the model size while ensuring accuracy, and has faster inference speed and higher efficiency. The GLM technical team’s exploration has not

What is the clock behind the TikTok label? How to tag Douyin account? What is the clock behind the TikTok label? How to tag Douyin account? Mar 24, 2024 pm 03:46 PM

When browsing Douyin works, we often see a clock icon behind the tag. So, what exactly is this clock? This article will focus on the discussion of "What is the clock behind the Douyin label", hoping to provide some useful reference for your use of Douyin. 1. What is the clock behind the Douyin label? Douyin will launch some hot topic challenges. When users participate, they will see a clock icon after the tag, which means that the work is participating in the topic challenge and displays the remaining time of the challenge. For some time-sensitive content, such as holidays, special events, etc., Douyin will attach a clock icon after the label to remind users of the validity period of the content. 3. Popular tags: When a tag becomes popular, Douyin will add a clock icon after the tag to indicate that the tag is

How to add tags on Douyin to attract traffic? Which tags on the platform are easiest to attract traffic to? How to add tags on Douyin to attract traffic? Which tags on the platform are easiest to attract traffic to? Mar 22, 2024 am 10:28 AM

As a popular short video social platform, Douyin has a huge user base. For Douyin creators, using tags to attract traffic is an effective way to increase the exposure of content and attract attention. So, how does Douyin use tags to attract traffic? This article will answer this question in detail for you and introduce related techniques. 1. How to add tags on Douyin to attract traffic? When posting a video, make sure to choose tags that are relevant to the content. These tags should cover the topic and keywords of your video to make it easier for users to find your video through tags. Leveraging popular hashtags is an effective way to increase your video’s exposure. Research current popular tags and trends and incorporate them into your video descriptions and tags. These popular tags usually have higher visibility and can attract the attention of more viewers. 3. Label

How to implement HTTP streaming using C++? How to implement HTTP streaming using C++? May 31, 2024 am 11:06 AM

How to implement HTTP streaming in C++? Create an SSL stream socket using Boost.Asio and the asiohttps client library. Connect to the server and send an HTTP request. Receive HTTP response headers and print them. Receives the HTTP response body and prints it.

Create Agent in one sentence! Robin Li: The era is coming when everyone is a developer Create Agent in one sentence! Robin Li: The era is coming when everyone is a developer Apr 17, 2024 pm 02:28 PM

The big model subverts everything, and finally got to the head of this editor. It is also an Agent that was created in just one sentence. Like this, give him an article, and in less than 1 second, fresh title suggestions will come out. Compared to me, this efficiency can only be said to be as fast as lightning and as slow as a sloth... What's even more incredible is that creating this Agent really only takes a few minutes. Prompt belongs to Aunt Jiang: And if you also want to experience this subversive feeling, now, based on the new Wenxin intelligent agent platform launched by Baidu, everyone can create their own intelligent assistant for free. You can use search engines, smart hardware platforms, speech recognition, maps, cars and other Baidu mobile ecological channels to let more people use your creativity! Robin Li himself

See all articles