destoon二次开发模板及调用语法汇总_php实例
一、模板存放及调用规则
模板存放于系统 template 目录,template 目录下的一个目录
例如:template/default/ 即为一套模板
模板文件以 .htm 为扩展名,可直接存放于模板目录
例如 template/default/index.htm
也可以存放于模板目录的子目录里
例如:template/default/member/index.htm
在PHP文件里,使用模板语法为
<?php include template('index'); ?>
或者
<?php include template('index', 'member'); ?>
如果当前默认模板套系为default,则:
<?php include template('header'); ?>
表示使用 template/default/header.htm 模板文件
<?php include template('header', 'member'); ?>
表示使用 template/default/member/header.htm 模板文件
模板目录下在 these.name.php 是模板别名的配置文件,模板别名可以在后台模板管理修改。
模板解析后的缓存文件保存于cache/tpl/目录,扩展名为 .tpl.php
二、模板语法
1、包含模板:{template 'header'} 或{template 'header', 'member'}
{template 'header'}被解析为
<?php include template('header'); ?>
表示使用 template/default/header.htm 模板文件
{template 'header', 'member'}
被解析为:
<?php include template('header','member'); ?>
表示使用 template/default/member/header.htm 模板文件
2、变量或常量表示:
变量 {$destoon} 被解析为:
<?php echo $destoon; ?>
常量 {DESTOON} 被解析为:
<?php echo DESTOON; ?>
对于数组,标准写法应为 例如 {$destoon['index']},可简写为{$destoon[index]},模板在解析时会自动追加引号。
3、函数 {func_name($par1, $par2)}
{func_name($par1, $par2)}被解析为
<?php func_name($par1, $par2); ?>
4、PHP表达式 {php expression}
{php expression}被解析为
<?php expression ?>
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}被解析为
<?php if($a=='b') { do A } ?>
{if $a=='b'} do A {else} do B {/if}被解析为
<?php if($a=='b') { do A } else { do B } ?>
{if $a=='b'} do A {elseif $b=='c'} do C {else} do B {/if}被解析为
<?php if($a=='b') { do A } else if($b=='c') { do C } else { do B } ?>
6、LOOP循环 {loop $var $v}...{loop} 或
{loop $var $k $v}...{loop}
{loop $var $v}...{loop}被解析为
<?php if(is_array($var)) { foreach($var as $v) { ... } } ?>
{loop $var $k $v}...{loop}被解析为
<?php if(is_array($var)) { foreach($var as $k=>$v) { ... } } ?>
三、特殊用法
1、变量或表达式可以用HTML注释,例如 仍被解析为 (可自动过滤此类注释)
2、可直接在模板里书写PHP代码,直接书写PHP代码与DESTOON 模板语法是兼容的。

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



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

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 "pioneer" of the domestic large model platform a year ago to today's large model "super factory", 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 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

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:

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]

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

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.

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
