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 resolves the nested template content to a PHP statement and merges it into the template
<!--{Subtemplate common/header}-->
Common/header header.html template file corresponding to the common directory in a template set
Program runtime include nested template content
<!--{Template common/header}--> Note: When there are more loops in the template, try to use subtemplate
- Logical judgment If...else
- if written in an HTML form element, you can save the code from making it clearer and easier to read, such as {if $my _var}xxx{/if}
<!--{if $_g[' uid ' ]}--> arbitrary HTML Statements <!--{/if}-->//is especially important if you are judging an attribute value of an HTML tag, preferably with <!----> comment symbol if it is outside the label
- If syntax with branching conditions
<!--{if $_g[' UID ']}--> any HTML statement <!--{ElseIf $_g[connectguest]}--> any HTML statement < !--{/if}-->
- with multi-conditional if notation, using the bitwise operator in PHP general judgment, such as
<!--{if empty ($_g[' forum ' [' Picstyle ']) && $_ Get[' by '] = = ' Lastpost ' && empty ($_get[' filter ')}-->
arbitrary HTML statements
<!--{/if}-->
- CSS can also be set by criteria when writing a setting such as:
<td class= "Fl_g" {if $forumcolwidth} width= "$forumcolwidth" {/if}>///As stated above, When judging the attribute values in the HTML tag, you can omit the comment <!----;
- Execute PHP code tag directly:<!--{eval echo $my _var;} -//equivalent to <?php echo $my _var;? >
<!--{eval $my _arr = Array (1, 2, 3);} -//equivalent to <?php $my _arr=array (a);? >
<!--{eval print_r ($my _arr);} -//equivalent to <?php print_r ($my _arr);? >
<!--{eval output ();} --//equivalent to <?php output ();? >
<!--{eval exit ();} -//equivalent to <?php exit ();? >
- Direct output variable, equivalent to PHP <?php echo $my _var;, curly braces can be omitted but not recommended. (The module program is processed before it can be called here): <div id= "ANC" ><ul id= "Ancl" > $announcements </ul></div>// In general, the output is not a simple variable
<!--{echo cutstr ($group [Lastpost][subject], 1)}-->//Conditions of Use: 2-variables need to be processed by the function-the output is a variable, not an array
- Ad embed Point code:<!--{ad/headerbanner/wp a_h}-->//This is discuz embedded ads, we recommend that you customize the ad bit, custom ad bit in the background will automatically generate the call code, we just paste copy to
- Plug-in hook tag:<!--{hook/global_usernav_extra2}-->
Hook as a keyword, meaning to define index_top as a hook
- Cyclic syntax (multiple loops) with array keys for loop notation
<!--{loop $my _arr $key $val}-->
HTML statements for looping output
<!--{/loop}-->
Loop notation with no array keys
<!--{loop $_g[' setting ' [' Navs '] $nav}-->
HTML statements for looping output
<!--{/loop}-->
- DIY zone and background data call tags:<!--[diy=diy1]--><div id= "diy1" class= "area" ></div><!--[/diy]-->// 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! Use of the template file after the language pack is loaded: {lang Forum_category_modedby}
Where language packs are stored in the./source/language/directory, in the form of an array of PHP
Discuz Template Label parsing