Discuz template syntax, discuz Template

Source: Internet
Author: User

Discuz template syntax, discuz Template

Discuz! The parsing of the X template is mainly for./source/class/class_template.php File Parsing. For more information, see this file!

  • Run the PHP code label directly: <! -- {Eval echo $ my_var;} --> // equivalent to <? Php echo $ my_var;?>
    <! -- {Eval $ my_arr = array (1, 2, 3) ;}--> // equivalent to <? Php $ my_arr = array (1, 2, 3);?>
    <! -- {Eval print_r ($ my_arr) ;}--> // equivalent to <? Php print_r ($ my_arr);?>
    <! -- {Eval output () ;}--> // equivalent to <? Php output ();?>
    <! -- {Eval exit () ;}--> // equivalent to <? Php exit ();?>
  • Directly output variables, equivalent to PHP <? Php echo $ my_var;?>, Curly braces can be omitted but are not recommended to be removed. (The Module Program can be called here after processing ): <div id = "anc"> <ul id = "ancl"> $ announcements </ul> </div> // generally, the output content is not a simple variable.
    <! -- {Echo cutstr ($ group [lastpost] [subject], 30)} --> // usage condition: 1-the variable must be processed by the function. 2-the output is a variable, cannot be an array
  • Embedded ad point code: <! -- {Ad/headerbanner/wp a_h} --> // This is an embedded discuz advertisement. We recommend that you customize the ad space. The custom ad space will automatically generate the call code in the background, we only need to paste and copy the file.
  • Hook tag of the plug-in: <! -- {Hook/global_usernav_extra2} -->
    Hook is a keyword that defines index_top as a hook.
  • Loop syntax (multiple loops) statement with array keys
    <! -- {Loop $ my_arr $ key $ val} -->
    HTML statement output by Loop
    <! -- {/Loop} -->

    Circular writing without array keys
    <! -- {Loop $ _ G ['setting'] ['navs'] $ nav} -->
    HTML statement output by Loop
    <! -- {/Loop} -->
  • DIY region and background data call labels: <! -- [Diy = diy1] --> <div id = "diy1" class = "area"> </div> <! -- [/Diy] --> // do not use the diy function of discuz as much as possible, because the maintenance is very large, you can directly use 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}
    The language Pack is stored in the./source/language/directory as a PHP array.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.