TYPO3中 flexforms.xml配置文件的書寫詳解
這個配置文件,本質(zhì)上是PHP數(shù)組,只是以xml格式進(jìn)行了配置,相對數(shù)組來說較為簡便。
節(jié)點(diǎn)描述
此處定義的所有元素都必須是XML標(biāo)記(下方列出的),不能出現(xiàn)字符串
| 節(jié)點(diǎn) | 介紹 | 元素 |
|---|---|---|
| <T3DataStructure> | 文件閉合標(biāo)簽(類似html文件中的html標(biāo)簽) |
<meta> <ROOT> <sheets> |
| <meta> | 可以包含針對特定應(yīng)用程序的元件設(shè)置 | (取決于應(yīng)用或?qū)傩裕?/td> |
| <ROOT> <[field name]> |
在文件中定義一個“元件對象” 1. <ROOT> 配置中的第一個元素的標(biāo)記。<ROOT>元素必須具有值為數(shù)組的<type>標(biāo)記,然后定義嵌套在<EL>標(biāo)記中的其他對象。 2.[field name] 定義對象名稱 |
<type> <section> <el> <[application tag]> |
| <sheets> | 定義“sheet”的集合,類似于獨(dú)立數(shù)據(jù)結(jié)構(gòu)的一維數(shù)字 | <[sheet name]> |
| <TCEforms> | 包含有關(guān)工作表的詳細(xì)信息。 如果是單個sheet頁,則適用于隱式的sheet | <sheetTitle> <cshFile> |
| <sheetTitle> | sheet頁的標(biāo)題 | · |
| <cshFile> | 用于flexforms.xml內(nèi)部字段的CSH語言文件。 | · |
| <[sheet ident]> | 定義以< ROOT>開頭的獨(dú)立數(shù)據(jù)結(jié)構(gòu)標(biāo)簽。 | <ROOT> |
| <el> | 包含數(shù)據(jù)結(jié)構(gòu)“object”的集合 | <[field name]> |
節(jié)點(diǎn)下的配置值描述
此處定義的所有元素都必須包含字符串(或整數(shù))值,而不包含任何其他的XML標(biāo)記!
| 節(jié)點(diǎn) | 數(shù)據(jù)格式 | 介紹 |
|---|---|---|
| <type> | "array", [blank] (=default) | 定義對象的類型。 1. “array” 表示對象只包含在同一級別的。<EL>標(biāo)記內(nèi)定義的其他對象的集合如果值為“array”,則可以使用布爾值“<section>?!币娤挛?。 2. 默認(rèn)值表示對象不包含子對象。這種對象的含義由使用本文件的應(yīng)用程序確定。對于flexforms,此對象將繪制表單元素。 |
| <section> | Boolean | 為<array>類型的對象定義它必須包含其他“array”類型對象。 |
實例
簡單示例:加載在 "mininews" 擴(kuò)展中的 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>
復(fù)雜示例:使用兩個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>