typo3

TYPO3中 flexforms.xml配置文件的书写详解

2019-05-15  本文已影响0人  是彬不是杉

原文链接:https://www.whongbin.com/archives/285.html

TYPO3中 flexforms.xml配置文件的书写详解

这个配置文件,本质上是PHP数组,只是以xml格式进行了配置,相对数组来说较为简便。

节点描述

此处定义的所有元素都必须是XML标记(下方列出的),不能出现字符串

节点 介绍 元素
<T3DataStructure> 文件闭合标签(类似html文件中的html标签) <meta>
<ROOT>
<sheets>
<meta> 可以包含针对特定应用程序的元件设置 (取决于应用或属性)
<ROOT>
<[field name]>
在文件中定义一个“元件对象”
1. <ROOT> 配置中的第一个元素的标记。<ROOT>元素必须具有值为数组的<type>标记,然后定义嵌套在<EL>标记中的其他对象。
2.[field name] 定义对象名称
<type>
<section>
<el>
<[application tag]>
<sheets> 定义“sheet”的集合,类似于独立数据结构的一维数字 <[sheet name]>
<TCEforms> 包含有关工作表的详细信息。 如果是单个sheet页,则适用于隐式的sheet <sheetTitle>
<cshFile>
<sheetTitle> sheet页的标题 ·
<cshFile> 用于flexforms.xml内部字段的CSH语言文件。 ·
<[sheet ident]> 定义以< ROOT>开头的独立数据结构标签。 <ROOT>
<el> 包含数据结构“object”的集合 <[field name]>

节点下的配置值描述

此处定义的所有元素都必须包含字符串(或整数)值,而不包含任何其他的XML标记!

节点 数据格式 介绍
<type> "array", [blank] (=default) 定义对象的类型。
1. “array” 表示对象只包含在同一级别的。<EL>标记内定义的其他对象的集合如果值为“array”,则可以使用布尔值“<section>。”见下文。
2. 默认值表示对象不包含子对象。这种对象的含义由使用本文件的应用程序确定。对于flexforms,此对象将绘制表单元素。
<section> Boolean 为<array>类型的对象定义它必须包含其他“array”类型对象。

实例

简单示例:加载在 "mininews" 扩展中的 FlexForm 配置

<T3DataStructure>
    <meta>
        <langDisable>1</langDisable>
    </meta>
    <ROOT>
        <type>array</type>
        <el>
            <field_templateObject>
                <TCEforms>
                    <label>选择模板(或使用LLL:EXT:mininews/locallang_db.php:tt_content.pi_flexform.select_template)</label>
                    <config>
                        <type>select</type>
                        <items>
                            <numIndex index="0">
                                <numIndex index="0"></numIndex>
                                <numIndex index="1">0</numIndex>
                            </numIndex>
                        </items>
                        <foreign_table>tx_templavoila_tmplobj</foreign_table>
                        <foreign_table_where>
                                AND tx_templavoila_tmplobj.pid=###STORAGE_PID###
                                AND tx_templavoila_tmplobj.datastructure="EXT:mininews/template_datastructure.xml"
                                AND tx_templavoila_tmplobj.parent=0
                                ORDER BY tx_templavoila_tmplobj.title
                        </foreign_table_where>
                        <size>1</size>
                        <minitems>0</minitems>
                        <maxitems>1</maxitems>
                    </config>
                </TCEforms>
            </field_templateObject>
        </el>
    </ROOT>
</T3DataStructure>

复杂示例:使用两个sheet “sDEF”和“s_welcome”。

<T3DataStructure>
    <sheets>
        <sDEF>
            <ROOT>
                <TCEforms>
                    <sheetTitle>LLL:EXT:newloginbox/locallang_db.php:tt_content.pi_flexform.sheet_general</sheetTitle>
                </TCEforms>
                <type>array</type>
                <el>
                <show_forgot_password>
                    <TCEforms>
                        <label>LLL:EXT:newloginbox/locallang_db.php:tt_content.pi_flexform.show_forgot_password</label>
                        <config>
                                <type>check</type>
                        </config>
                    </TCEforms>
                </show_forgot_password>
                </el>
            </ROOT>
        </sDEF>
        <s_welcome>
            <ROOT>
                <TCEforms>
                    <sheetTitle>LLL:EXT:newloginbox/locallang_db.php:tt_content.pi_flexform.sheet_welcome</sheetTitle>
                </TCEforms>
                <type>array</type>
                <el>
                    <header>
                        <TCEforms>
                            <label>LLL:EXT:newloginbox/locallang_db.php:tt_content.pi_flexform.header</label>
                            <config>
                                <type>input</type>
                                <size>30</size>
                            </config>
                        </TCEforms>
                    </header>
                    <message>
                        <TCEforms>
                            <label>LLL:EXT:newloginbox/locallang_db.php:tt_content.pi_flexform.message</label>
                            <config>
                                <type>text</type>
                                <cols>30</cols>
                                <rows>5</rows>
                            </config>
                        </TCEforms>
                    </message>
                </el>
            </ROOT>
        </s_welcome>
    </sheets>
</T3DataStructure>
上一篇 下一篇

猜你喜欢

热点阅读