discuz! The parsing of the X-template is mainly the./source/class/class_template.php file parsing process, if you need further information please take a look at this file!
Template nesting syntax
To parse the nested template content into a PHP statement and merge it into this template
Common/header header.html template file corresponding to the common directory in a template set
Program runtime include nested template content
Note: When there are more loops in the template, try to use subtemplate
-
Logic if...else
- If you write in an HTML form element, you can avoid making the code clearer and easier to read, such as {if $my _var}xxx{/if}
!--{if $ _g[' UID ']}--> arbitrary HTML statement!--{/if}-->//is especially important if you are judging an attribute value of an HTML tag, preferably in addition to the!----> comment symbol
- if notation with branching conditions
!--{if $_g[' UID ']}--> any HTML statement,!--{elseif $_g[connectguest]}--> any HTML statement!--{/if}-->
- with multi-conditional if notation, such as
!--{if empty ($_g[' forum '] [' Picstyle ']), using the bitwise operator in PHP general judgment && $_get[' ORDER BY '] = = ' LASTP Ost ' && empty ($_get[' filter ')}-->
arbitrary HTML statements
!--{/if}-->
- CSS can also be set by criteria when writing a setting such as:
///As stated above, you can omit the comment when judging the value of the attribute in the HTML tag "!----"
Execute the PHP code tag directly:
Equivalent
Equivalent
Equivalent
Equivalent
Equivalent
Direct output variables, equivalent to PHP , curly braces can be omitted but not recommended to remove. (The module program is processed before it can be called here):
//Normally output is not a simple variable
Conditions of Use: 1-the variable needs to be processed by the function 2-the output is a variable, not an array
Embed point code for ads:
This is discuz embedded ads, we recommend that you customize the ad bit, the custom ad bit in the background will automatically generate the call code, we just paste copy to
Plug-in Hook tags:
Hook as a keyword, meaning to define index_top as a hook
Looping syntax (multiple loops possible)
Loop notation with array keys
HTML statements for looping output
Loop notation with no array keys
HTML statements for looping output
DIY zone and background data call Tags:
Try to avoid the use of Discuz DIY features, because maintenance people are very large, can directly through the background custom module or module code
{Block XXX}(data call module)
discuz! After the language pack is loaded, use in the template file:
{lang Forum_category_modedby}
Where language packs are stored in the./source/language/directory, in the form of an array of PHP
The above describes the Discuz template syntax, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.