1

拥有并转换基于TemplaVoila的网站时,我创建了必要的 gridelements 并使用 templavoila flexforms 来做这件事。我遇到的问题是当我尝试获取 flexforms 的数据时

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3DataStructure>
    <meta type="array">
        <langDisable>1</langDisable>
    </meta>
    <ROOT type="array">
        <tx_templavoila type="array">
            <title>ROOT</title>
            <description>Select the HTML element on the page which you want to be the overall container element for the template.</description>
        </tx_templavoila>
        <type>array</type>
        <el type="array">
            <field_b53fc0 type="array">
                <type>array</type>
                <tx_templavoila type="array">
                    <title>Element hinzufügen</title>
                    <eType>input</eType>
                    <preview></preview>
                </tx_templavoila>
                <el type="array">
                    <field_78a762 type="array">
                        <type>array</type>
                        <tx_templavoila type="array">
                            <title>Element hinzufügen</title>
                            <eType>input</eType>
                            <TypoScript></TypoScript>
                            <proc type="array">
                                <int>0</int>
                                <HSC>0</HSC>
                                <stdWrap></stdWrap>
                            </proc>
                            <preview></preview>
                        </tx_templavoila>
                        <TCEforms type="array">
                            <label></label>
                            <config type="array">
                            </config>
                        </TCEforms>
                        <el type="array">
                            <field_7b6fd2 type="array">
                                <type>attr</type>
                                <tx_templavoila type="array">
                                    <title>Maske</title>
                                    <sample_data type="array">
                                        <numIndex index="0"></numIndex>
                                    </sample_data>
                                    <eType>image</eType>
                                    <TypoScript>10 = IMG_RESOURCE
10.stdWrap.wrap = background-image:url(|);
10.file.import = uploads/tx_templavoila/
10.file.import.current = 1
10.file.import.listNum = 0
</TypoScript>
                                    <proc type="array">
                                        <int>0</int>
                                        <HSC>0</HSC>
                                        <stdWrap></stdWrap>
                                    </proc>
                                    <preview></preview>
                                </tx_templavoila>
                                <TCEforms type="array">
                                    <label>Hintergrundbild</label>
                                    <config type="array">
                                        <type>group</type>
                                        <internal_type>file</internal_type>
                                        <allowed>gif,png,jpg,jpeg</allowed>
                                        <max_size>1000</max_size>
                                        <uploadfolder>uploads/tx_templavoila</uploadfolder>
                                        <show_thumbs>1</show_thumbs>
                                        <size>1</size>
                                        <maxitems>1</maxitems>
                                        <minitems>0</minitems>
                                    </config>
                                </TCEforms>
                            </field_7b6fd2>
                            <field_4f69c2 type="array">
                                <tx_templavoila type="array">
                                    <title>Produktbild</title>
                                    <sample_data type="array">
                                        <numIndex index="0"></numIndex>
                                    </sample_data>
                                    <eType>image</eType>
                                    <TypoScript>10 = IMAGE
10.file.import = uploads/tx_templavoila/
10.file.import.current = 1
10.file.import.listNum = 0</TypoScript>
                                    <preview></preview>
                                    <proc type="array">
                                        <int>0</int>
                                        <HSC>0</HSC>
                                        <stdWrap></stdWrap>
                                    </proc>
                                </tx_templavoila>
                                <TCEforms type="array">
                                    <label>Produktbild</label>
                                    <config type="array">
                                        <type>group</type>
                                        <internal_type>file</internal_type>
                                        <allowed>gif,png,jpg,jpeg</allowed>
                                        <max_size>1000</max_size>
                                        <uploadfolder>uploads/tx_templavoila</uploadfolder>
                                        <show_thumbs>1</show_thumbs>
                                        <size>1</size>
                                        <maxitems>1</maxitems>
                                        <minitems>0</minitems>
                                    </config>
                                </TCEforms>
                            </field_4f69c2>
                            <field_1a6a3a type="array">
                                <tx_templavoila type="array">
                                    <title>Headline</title>
                                    <sample_data type="array">
                                        <numIndex index="0"></numIndex>
                                    </sample_data>
                                    <eType>input</eType>
                                    <proc type="array">
                                        <HSC type="integer">1</HSC>
                                        <stdWrap></stdWrap>
                                    </proc>
                                    <preview></preview>
                                    <TypoScript type="NULL"></TypoScript>
                                </tx_templavoila>
                                <TCEforms type="array">
                                    <label>Headline</label>
                                    <config type="array">
                                        <type>input</type>
                                        <size>48</size>
                                        <eval>trim</eval>
                                    </config>
                                </TCEforms>
                            </field_1a6a3a>
                            <field_d696e9 type="array">
                                <tx_templavoila type="array">
                                    <title>Subline</title>
                                    <sample_data type="array">
                                        <numIndex index="0"></numIndex>
                                    </sample_data>
                                    <eType>input</eType>
                                    <proc type="array">
                                        <HSC type="integer">1</HSC>
                                        <stdWrap></stdWrap>
                                    </proc>
                                    <preview></preview>
                                    <TypoScript type="NULL"></TypoScript>
                                </tx_templavoila>
                                <TCEforms type="array">
                                    <label>Subline</label>
                                    <config type="array">
                                        <type>input</type>
                                        <size>48</size>
                                        <eval>trim</eval>
                                    </config>
                                </TCEforms>
                            </field_d696e9>
                            <field_055de1 type="array">
                                <tx_templavoila type="array">
                                    <title>Text</title>
                                    <sample_data type="array">
                                        <numIndex index="0"></numIndex>
                                    </sample_data>
                                    <eType>rte</eType>
                                    <TypoScript><![CDATA[
10 = TEXT
10.current = 1
10.parseFunc = < lib.parseFunc_RTE]]></TypoScript>
                                    <preview></preview>
                                </tx_templavoila>
                                <TCEforms type="array">
                                    <label>Text</label>
                                    <config type="array">
                                        <type>text</type>
                                        <cols>48</cols>
                                        <rows>5</rows>
                                        <softref>rtehtmlarea_images,typolink_tag,images,email[subst],url</softref>
                                    </config>
                                    <defaultExtras>richtext:rte_transform[flag=rte_enabled|mode=ts_css]</defaultExtras>
                                </TCEforms>
                            </field_055de1>
                            <field_373e2b type="array">
                                <tx_templavoila type="array">
                                    <title>Zum Produkt (Link)</title>
                                    <sample_data type="array">
                                        <numIndex index="0"></numIndex>
                                    </sample_data>
                                    <eType>link</eType>
                                    <TypoScript><![CDATA[10 = TEXT
10.field = field_0db16f
10.ifEmpty = {$SLIDER_INDEX_BTN_PROD}
10.innerWrap = <span>|</span>
10.typolink.parameter.current = 1
10.typolink.ATagParams = class="Button"
10.if.isTrue.field = field_373e2b
]]></TypoScript>
                                    <proc type="array">
                                        <int>0</int>
                                        <HSC>0</HSC>
                                        <stdWrap></stdWrap>
                                    </proc>
                                    <preview></preview>
                                    <TypoScript_constants type="array">
                                        <SLIDER_INDEX_BTN_PROD>{$_CONSTANTS.SLIDER_INDEX_BTN_PROD}</SLIDER_INDEX_BTN_PROD>
                                    </TypoScript_constants>
                                </tx_templavoila>
                                <TCEforms type="array">
                                    <label>Zum Produkt (Link)</label>
                                    <config type="array">
                                        <type>input</type>
                                        <size>15</size>
                                        <max>256</max>
                                        <checkbox></checkbox>
                                        <eval>trim</eval>
                                        <wizards type="array">
                                            <_PADDING type="integer">2</_PADDING>
                                            <link type="array">
                                                <type>popup</type>
                                                <title>Link</title>
                                                <icon>link_popup.gif</icon>
                                                <script>browse_links.php?mode=wizard</script>
                                                <JSopenParams>height=300,width=500,status=0,menubar=0,scrollbars=1</JSopenParams>
                                            </link>
                                        </wizards>
                                    </config>
                                </TCEforms>
                            </field_373e2b>
                            <field_3bf1df type="array">
                                <tx_templavoila type="array">
                                    <title>Zur Anwendung (Link)</title>
                                    <sample_data type="array">
                                        <numIndex index="0"></numIndex>
                                    </sample_data>
                                    <eType>link</eType>
                                    <TypoScript_constants type="array">
                                        <SLIDER_INDEX_BTN_ANW>{$_CONSTANTS.SLIDER_INDEX_BTN_ANW}</SLIDER_INDEX_BTN_ANW>
                                    </TypoScript_constants>
                                    <TypoScript><![CDATA[10 = TEXT
10.value = {$SLIDER_INDEX_BTN_ANW}
10.innerWrap = <span>|</span>
10.typolink.parameter.current = 1
10.typolink.ATagParams = class="Button Weiss"
10.if.isTrue.field = field_3bf1df]]></TypoScript>
                                    <proc type="array">
                                        <int>0</int>
                                        <HSC>0</HSC>
                                        <stdWrap></stdWrap>
                                    </proc>
                                    <preview></preview>
                                </tx_templavoila>
                                <TCEforms type="array">
                                    <label>Zur Anwendung (Link)</label>
                                    <config type="array">
                                        <type>input</type>
                                        <size>15</size>
                                        <max>256</max>
                                        <checkbox></checkbox>
                                        <eval>trim</eval>
                                        <wizards type="array">
                                            <_PADDING type="integer">2</_PADDING>
                                            <link type="array">
                                                <type>popup</type>
                                                <title>Link</title>
                                                <icon>link_popup.gif</icon>
                                                <script>browse_links.php?mode=wizard</script>
                                                <JSopenParams>height=300,width=500,status=0,menubar=0,scrollbars=1</JSopenParams>
                                            </link>
                                        </wizards>
                                    </config>
                                </TCEforms>
                            </field_3bf1df>
                            <field_a73d1b type="array">
                                <tx_templavoila type="array">
                                    <title>360° Teaser</title>
                                    <sample_data type="array">
                                        <numIndex index="0"></numIndex>
                                    </sample_data>
                                    <eType>check</eType>
                                    <TypoScript_constants type="array">
                                        <SLIDER_INDEX_PRODAN>{$_CONSTANTS.SLIDER_INDEX_PRODAN}</SLIDER_INDEX_PRODAN>
                                    </TypoScript_constants>
                                    <TypoScript><![CDATA[10 = COA
10 {
  10 = TEXT
  10.value = <h2>360

  20 = TEXT
  20.value = <span>&deg;</span></h2>

  30 = TEXT
  30.value = {$SLIDER_INDEX_PRODAN}
  30.wrap = <p>|</p>
}
10.if.isTrue.field = field_a73d1b

]]></TypoScript>
                                    <proc type="array">
                                        <int>0</int>
                                        <HSC>0</HSC>
                                        <stdWrap></stdWrap>
                                    </proc>
                                    <preview></preview>
                                </tx_templavoila>
                                <TCEforms type="array">
                                    <label>360° Teaser</label>
                                    <config type="array">
                                        <type>check</type>
                                        <default type="integer">0</default>
                                    </config>
                                </TCEforms>
                            </field_a73d1b>
                            <field_0db16f type="array">
                                <tx_templavoila type="array">
                                    <title>Zum Produkt (Titel)</title>
                                    <sample_data type="array">
                                        <numIndex index="0"></numIndex>
                                    </sample_data>
                                    <eType>input</eType>
                                    <proc type="array">
                                        <HSC type="integer">1</HSC>
                                        <stdWrap></stdWrap>
                                    </proc>
                                    <preview></preview>
                                    <TypoScript type="NULL"></TypoScript>
                                </tx_templavoila>
                                <TCEforms type="array">
                                    <label>Zum Produkt (Titel)</label>
                                    <config type="array">
                                        <type>input</type>
                                        <size>48</size>
                                        <eval>trim</eval>
                                    </config>
                                </TCEforms>
                            </field_0db16f>
                            <field_ad4f50 type="array">
                                <tx_templavoila type="array">
                                    <title>Video</title>
                                    <sample_data type="array">
                                        <numIndex index="0"></numIndex>
                                    </sample_data>
                                    <eType>check</eType>
                                    <TypoScript><![CDATA[10 = COA
10 {
 10 = TEXT
 10.field = field_0db16f
 10.wrap = <span>|</span>

 20 = TEXT
 20.field = field_1a6a3a
 20.wrap = <h4>|</h4>

 30 = TEXT
 30.field = field_055de1
 30.wrap = <h3>|</h3>

}
10.if.isTrue.field = field_ad4f50]]></TypoScript>
                                    <preview></preview>
                                    <proc type="array">
                                        <int>0</int>
                                        <HSC>0</HSC>
                                        <stdWrap></stdWrap>
                                    </proc>
                                </tx_templavoila>
                                <TCEforms type="array">
                                    <label>Video</label>
                                    <config type="array">
                                        <type>check</type>
                                        <default type="integer">0</default>
                                    </config>
                                </TCEforms>
                            </field_ad4f50>
                            <field_b2b651 type="array">
                                <type>attr</type>
                                <tx_templavoila type="array">
                                    <title>Youtube-Code</title>
                                    <sample_data type="array">
                                        <numIndex index="0"></numIndex>
                                    </sample_data>
                                    <eType>input</eType>
                                    <TypoScript type="NULL"></TypoScript>
                                    <proc type="array">
                                        <int>0</int>
                                        <HSC>1</HSC>
                                        <stdWrap></stdWrap>
                                    </proc>
                                    <preview></preview>
                                </tx_templavoila>
                                <TCEforms type="array">
                                    <label>Youtube-Code</label>
                                    <config type="array">
                                        <type>input</type>
                                        <size>48</size>
                                        <eval>trim</eval>
                                    </config>
                                </TCEforms>
                            </field_b2b651>
                        </el>
                    </field_78a762>
                </el>
                <section>1</section>
            </field_b53fc0>
        </el>
    </ROOT>
</T3DataStructure>
tt_content.gridelements_pi1.20.10.setup {
     # ID of gridelement // eLearning 2 Spalter
     1 < temp.gridelements.defaultGridSetup
     1 {
          stdWrap.cObject = COA
          stdWrap.cObject {
               10 = TEXT
               10 {
                    data = field:flexform_field_4f69c2
                    wrap = <H1>|</H1>
               }

               20 = IMAGE
               20{
                    file{
                      import.data = field:flexform_field_7b6fd2
                      width = 256
                 }
               }

          }
          wrap = <li>|</li>
     }
}
4

2 回答 2

1

Gridelements 似乎不支持带有部分的 flexforms 我所做的是使用另一个扩展来解决工作,称为 XPATH 内容对象https://typo3.org/extensions/repository/view/cobj_xpath

10 = XPATH
10 {
 source.data = DB:tt_content:{field:uid}:pi_flexform 
 source.data.insertData = 1 

 return = string

 expression = //field[@index='field_7b6fd2']/value

 # configure the resultObj
 resultObj {

   cObjNum = 1
   1.current = 1
   1.wrap = <img src="uploads/tx_templavoila/|" />

   }
}
于 2017-02-17T19:49:56.303 回答
0

您为标题使用了错误的字段(标题字段应该是 field_1a6a3a)。此外,您必须将导入图像的路径设置如下

20 = IMAGE
20 {
    file {
        import = uploads/tx_templavoila/
        import.data = field:flexform_field_7b6fd2
        width = 256
    }
}
于 2017-01-30T07:42:47.437 回答