Home Backend Development PHP Tutorial destoon二次开发模板及调用语法汇总_php实例

destoon二次开发模板及调用语法汇总_php实例

Jun 07, 2016 pm 05:18 PM
Secondary development template

一、模板存放及调用规则

模板存放于系统 template 目录,template 目录下的一个目录
例如:template/default/ 即为一套模板

模板文件以 .htm 为扩展名,可直接存放于模板目录
例如 template/default/index.htm
也可以存放于模板目录的子目录里
例如:template/default/member/index.htm

在PHP文件里,使用模板语法为

<&#63;php
 include template('index');
&#63;>

Copy after login

或者

<&#63;php
 include template('index', 'member');
&#63;>

Copy after login

如果当前默认模板套系为default,则:

<&#63;php
 include template('header');
&#63;>

Copy after login
Copy after login

表示使用 template/default/header.htm 模板文件

<&#63;php
 include template('header', 'member');
&#63;>

Copy after login

表示使用 template/default/member/header.htm 模板文件

模板目录下在 these.name.php 是模板别名的配置文件,模板别名可以在后台模板管理修改。

模板解析后的缓存文件保存于cache/tpl/目录,扩展名为 .tpl.php

二、模板语法

1、包含模板:{template 'header'} 或{template 'header', 'member'}

{template 'header'}被解析为

<&#63;php
 include template('header');
&#63;>

Copy after login
Copy after login

表示使用 template/default/header.htm 模板文件

{template 'header', 'member'}

被解析为:

<&#63;php
 include template('header','member');
&#63;>
Copy after login

表示使用 template/default/member/header.htm 模板文件

2、变量或常量表示:

变量 {$destoon} 被解析为:

<&#63;php
 echo $destoon;
&#63;>
Copy after login

常量 {DESTOON} 被解析为:

<&#63;php
 echo DESTOON;
&#63;>
Copy after login

对于数组,标准写法应为 例如 {$destoon['index']},可简写为{$destoon[index]},模板在解析时会自动追加引号。

3、函数 {func_name($par1, $par2)}

{func_name($par1, $par2)}被解析为

<&#63;php
 func_name($par1, $par2);
&#63;>

Copy after login

4、PHP表达式 {php expression}

{php expression}被解析为

<&#63;php
 expression 
&#63;>
Copy after login

5、条件语句 {if $a=='b'} do A {/if} 或{if $a=='b'} do A {else} do B {/if} 或 {if $a=='b'} do A{elseif $b=='c'} do C {else} do B {/if}

{if $a=='b'} do A {/if}被解析为

<&#63;php
 if($a=='b') {
 do A
 }
&#63;>

Copy after login

{if $a=='b'} do A {else} do B {/if}被解析为

<&#63;php
 if($a=='b') {
 do A 
 } else {
 do B
 } 
&#63;>

Copy after login

{if $a=='b'} do A {elseif $b=='c'} do C {else} do B {/if}被解析为

<&#63;php
 if($a=='b') {
 do A 
 } else if($b=='c') {
 do C
 } else {
 do B
 } 
&#63;>

Copy after login

6、LOOP循环 {loop $var $v}...{loop} 或

{loop $var $k $v}...{loop}

{loop $var $v}...{loop}被解析为

<&#63;php
 if(is_array($var)) {
 foreach($var as $v) {
 ... }
 }
&#63;>

Copy after login

{loop $var $k $v}...{loop}被解析为

<&#63;php
 if(is_array($var)) {
 foreach($var as $k=>$v) {
 ... }
 }
&#63;>

Copy after login

三、特殊用法

1、变量或表达式可以用HTML注释,例如 仍被解析为 (可自动过滤此类注释)

2、可直接在模板里书写PHP代码,直接书写PHP代码与DESTOON 模板语法是兼容的。

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

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)

Simple and easy-to-understand Java Hikvision SDK secondary development guide Simple and easy-to-understand Java Hikvision SDK secondary development guide Sep 06, 2023 pm 02:01 PM

Simple and easy-to-understand Java Hikvision SDK secondary development guide Introduction: With the development of camera surveillance technology, Hikvision has become one of the world's leading security solution providers. The SDK (software development kit) it provides is Developers provide a wealth of functions and interfaces for secondary development and customized development. This article will introduce how to use Java language for secondary development of Hikvision SDK, and provide some code examples to help readers better understand and apply. 1. Environment preparation First, before carrying out secondary development of Hikvision SDK

Baidu Intelligent Cloud Qianfan large model platform has been upgraded again: 5 large models and 55 new tool components have been released! Baidu Intelligent Cloud Qianfan large model platform has been upgraded again: 5 large models and 55 new tool components have been released! Mar 22, 2024 am 08:10 AM

Serving 80,000 enterprise users, it has helped users fine-tune 13,000 large models and helped users develop 160,000 large model applications. Since December 2023, the daily API calls of Baidu Smart Cloud Qianfan Large Model Platform have increased by 97% month-on-month. ..From the &quot;pioneer&quot; of the domestic large model platform a year ago to today's large model &quot;super factory&quot;, Baidu Intelligent Cloud Qianfan large model platform firmly occupies a leading position in the domestic large model market, but its pace is slow. Didn't stop. On March 21, Baidu Intelligent Cloud held a Qianfan product launch conference in Beijing Shougang Park. Baidu Intelligent Cloud announced during the conference: 1. Joining hands with Beijing Shijingshan District to build the country's first Baidu Intelligent Cloud Qianfan large-scale model industrial innovation base to help Promote the take-off of regional industries; 2. Satisfy the “valency” of enterprises

PHP email templates: customize and personalize your email content. PHP email templates: customize and personalize your email content. Sep 19, 2023 pm 01:21 PM

PHP email templates: Customize and personalize your email content With the popularity and widespread use of email, traditional email templates can no longer meet people's needs for personalized and customized email content. Now we can create customized and personalized email templates by using PHP programming language. This article will show you how to use PHP to achieve this goal, and provide some specific code examples. 1. Create an email template First, we need to create a basic email template. This template can be an HTM

TensorFlow deep learning framework model inference pipeline for portrait cutout inference TensorFlow deep learning framework model inference pipeline for portrait cutout inference Mar 26, 2024 pm 01:00 PM

Overview In order to enable ModelScope users to quickly and conveniently use various models provided by the platform, a set of fully functional Python libraries are provided, which includes the implementation of ModelScope official models, as well as the necessary tools for using these models for inference, finetune and other tasks. Code related to data pre-processing, post-processing, effect evaluation and other functions, while also providing a simple and easy-to-use API and rich usage examples. By calling the library, users can complete tasks such as model reasoning, training, and evaluation by writing just a few lines of code. They can also quickly perform secondary development on this basis to realize their own innovative ideas. The algorithm model currently provided by the library is:

How to add PPT mask How to add PPT mask Mar 20, 2024 pm 12:28 PM

Regarding PPT masking, many people must be unfamiliar with it. Most people do not understand it thoroughly when making PPT, but just make it up to make what they like. Therefore, many people do not know what PPT masking means, nor do they understand it. I know what this mask does, and I don’t even know that it can make the picture less monotonous. Friends who want to learn, come and learn, and add some PPT masks to your PPT pictures. Make it less monotonous. So, how to add a PPT mask? Please read below. 1. First we open PPT, select a blank picture, then right-click [Set Background Format] and select a solid color. 2. Click [Insert], word art, enter the word 3. Click [Insert], click [Shape]

Key elements to improve secondary development skills of Java Hikvision SDK Key elements to improve secondary development skills of Java Hikvision SDK Sep 06, 2023 pm 01:42 PM

Summary of key elements to improve Java Hikvision SDK secondary development skills: With the rapid development of the Internet of Things, video surveillance systems are increasingly used in the security field. As the most important component of the video surveillance system, Hikvision’s SDK plays an important role in the secondary development process. This article will introduce the basic usage of Hikvision SDK and provide some key elements and code examples to help readers improve their Java Hikvision SDK secondary development skills. 1. Understand the basic overview of Hikvision SDK

Effects of C++ template specialization on function overloading and overriding Effects of C++ template specialization on function overloading and overriding Apr 20, 2024 am 09:09 AM

C++ template specializations affect function overloading and rewriting: Function overloading: Specialized versions can provide different implementations of a specific type, thus affecting the functions the compiler chooses to call. Function overriding: The specialized version in the derived class will override the template function in the base class, affecting the behavior of the derived class object when calling the function.

Template Metaprogramming in C++ FAQ Interview Questions Template Metaprogramming in C++ FAQ Interview Questions Aug 22, 2023 pm 03:33 PM

C++ is a programming language widely used in various fields. Its template metaprogramming is an advanced programming technique that allows programmers to transform types and values ​​at compile time. Template metaprogramming is a widely discussed topic in C++, so questions related to it are quite common in interviews. Here are some common template metaprogramming interview questions in C++ that you may be asked. What is template metaprogramming? Template metaprogramming is a technique for manipulating types and values ​​at compile time. It uses templates and metafunctions to generate based on types and values

See all articles