First, the template storage and call rules
The template is stored in the System template directory, a directory under the template directory
For example: template/default/is a set of templates
Template files are extended with. htm and can be stored directly in the template directory
such as Template/default/index.htm
can also be stored in a subdirectory of the template directory
For example: template/default/member/index.htm
In the PHP file, use the template syntax for
<?php
include template (' index ');
? >
Or
<?php
include template (' Index ', ' member ');
? >
If the current default template sleeve is defaulted:
<?php
include template (' header ');
? >
Indicates the use of the template/default/header.htm template file
<?php
include template (' header ', ' member ');
? >
Indicates the use of the template/default/member/header.htm template file
In the template directory under these.name.php is the template alias profile, the template alias can be modified in the background template management.
The cached files after the template resolution are saved in the cache/tpl/directory with the extension. tpl.php
Second, the template syntax
1, include template : {Template ' header '} or {template ' header ', ' member '}
{Template ' header '} is resolved as
<?php
include template (' header ');
? >
Indicates the use of the template/default/header.htm template file
{Template ' header ', ' member '}
is resolved to:
<?php
include template (' header ', ' member ');
? >
Indicates the use of the template/default/member/header.htm template file
2, variable or constant means:
The variable {$destoon} is resolved to:
The constant {Destoon} is resolved to:
For arrays, the standard notation should be for example {$destoon [' Index ']}, which can be abbreviated to {$destoon [index]}, and the template will automatically append quotes when parsing.
3. Function {Func_name ($par 1, $par 2)}
{Func_name ($par 1, $par 2)} is resolved to
<?php
Func_name ($par 1, $par 2);
>
4. PHP expression {PHP expression}
{PHP expression} is resolved as
5, conditional statement {if $a = = ' B '} do a {/if} or {if $a = = ' B '} do an {else} do b {/if} or {if $a = = ' B '} do a{elseif $b = = ' C '} do c {else} do b {/if}
{if $a = = ' B '} do a {/if} is resolved to
<?php
if ($a = = ' B ') {do
a
}
?>
{if $a = = ' B '} does a {else} do b {/if} is resolved to
<?php
if ($a = = ' B ') {do
a
} else {do
b
}
?>
{if $a = = ' B '} do a {elseif $b = = ' C '} do c {else} does B {/if} is resolved to
<?php
if ($a = = ' B ') {do
a
} else if ($b = = ' C ') {do
C
} else {do
b
}
?>
6. Loop Loop {loop $var $v} ... {Loop} or
{Loop $var $k $v} ... {Loop}
{loop $var $v} ... {loop} is resolved to
<?php
if (Is_array ($var)) {
foreach ($var as $v) {
...}}
? >
{Loop $var $k $v} ... {loop} is resolved to
<?php
if (Is_array ($var)) {
foreach ($var as $k => $v) {
...}}
? >
Third, special use
1, variables or expressions can be HTML annotations , such as <!--{$destoon}--> is still resolved to <?php echo $destoon;?> (this type of annotation can be automatically filtered)
2, you can write PHP code directly in the template , the direct writing of PHP code and Destoon template syntax is compatible.