search
Homephp教程php手册discuz模板语法,discuz模板

discuz模板语法,discuz模板

Jun 13, 2016 am 09:06 AM
classdiscuzsourcetemphosttemplateofparsegrammar

discuz模板语法,discuz模板

Discuz! X 模板的解析主要是 ./source/class/class_template.php 文件解析处理的,如果需要深入了解请可以看看这个文件!

  •  直接执行 PHP 代码标签:

    //相当于
    //相当于
    //相当于
    //相当于
    //相当于
  •  直接输出变量,等同于 PHP 的 , 花括号可以省略但不建议去掉。(模块程序处理后才能在这里调用):

      $announcements
    //一般情况下输出的内容不是简单的变量
    //使用条件:1-变量需经函数处理  2-输出的是变量,不能是数组
  •  广告的嵌入点代码:

    //这是discuz内嵌广告,建议大家自定义广告位,自定义的广告位在后台会自动生成调用代码,我们只需要粘贴复制即可
  •  插件的钩子标签:


    hook为关键词,意为将index_top定义为钩子
  •  循环语法(可以多重循环)

    带有数组键的循环写法

        循环输出的HTML语句


    没有数组键的循环写法

        循环输出的HTML语句
  •  DIY 区域和后台数据调用标签:

     //尽量避免使用discuz的diy功能,因为维护大家很大,可直接通过后台自定义模块或模块代码
    {block XXX}(数据调用模块)
  •  Discuz! 语言包加载后,模板文件中的使用:

    {lang forum_category_modedby}
    其中语言包在 ./source/language/目录下,以PHP数组形式存放
  • Statement
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Tools

    SublimeText3 Linux new version

    SublimeText3 Linux new version

    SublimeText3 Linux latest version

    VSCode Windows 64-bit Download

    VSCode Windows 64-bit Download

    A free and powerful IDE editor launched by Microsoft

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    Dreamweaver Mac version

    Dreamweaver Mac version

    Visual web development tools

    WebStorm Mac version

    WebStorm Mac version

    Useful JavaScript development tools