我發現了這個我想用於自己的很酷的解決方案。 (Example) 這是一個如何與DCE一起使用FAL來獲取多個圖像的示例。TYPO3 FAL圖像讀取
如果我嘗試這種解決方案我會在我的網站下面的錯誤輸出:
Oops, an error occurred! Code: 20170309155903dbbf0d11
有時候,我什麼也沒有了,沒有錯誤沒有圖像。
那我詳細的解決方案: 我用相同的配置,除了最後兩行的文件摘要層:
<config>
<type>inline</type>
<foreign_table>sys_file_reference</foreign_table>
<foreign_field>uid_foreign</foreign_field>
<foreign_sortby>sorting_foreign</foreign_sortby>
<foreign_table_field>tablenames</foreign_table_field>
<foreign_match_fields>
<fieldname>myImages</fieldname> <!-- CAUTION!! Replace "fal" with the variable name of this field! -->
</foreign_match_fields>
<foreign_label>uid_local</foreign_label>
<foreign_selector>uid_local</foreign_selector>
<foreign_selector_fieldTcaOverride>
<config>
<appearance>
<elementBrowserType>file</elementBrowserType>
<elementBrowserAllowed>gif,jpg,jpeg,tif,tiff,bmp,pcx,tga,png,pdf,ai,svg</elementBrowserAllowed>
</appearance>
</config>
</foreign_selector_fieldTcaOverride>
<foreign_types type="array">
<numIndex index="2">
<showitem>--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette</showitem>
</numIndex>
</foreign_types>
<minitems>0</minitems>
<maxitems>10</maxitems>
<appearance>
<useSortable>1</useSortable>
<headerThumbnail>
<field>uid_local</field>
<width>45c</width>
<height>45</height>
</headerThumbnail>
<showPossibleLocalizationRecords>0</showPossibleLocalizationRecords>
<showRemovedLocalizationRecords>0</showRemovedLocalizationRecords>
<showSynchronizationLink>0</showSynchronizationLink>
<useSortable>1</useSortable>
<enabledControls>
<info>1</info>
<new>0</new>
<dragdrop>0</dragdrop>
<sort>1</sort>
<hide>1</hide>
<delete>1</delete>
<localize>1</localize>
</enabledControls>
<createNewRelationLinkTitle>LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference</createNewRelationLinkTitle>
</appearance>
<behaviour>
<localizationMode>select</localizationMode>
<localizeChildrenAtParentLocalization>1</localizeChildrenAtParentLocalization>
</behaviour>
<dce_load_schema>1</dce_load_schema>
<dce_get_fal_objects>1</dce_get_fal_objects> </config>
我的字段名稱爲myImages。所以變量名稱設置正確。 我的代碼和例子之間的唯一區別是最後兩行。
<dce_load_schema>1</dce_load_schema>
<dce_get_fal_objects>1</dce_get_fal_objects>
在我的模板我使用此代碼,讓我的圖片:當我刪除這兩條線 但沒有什麼是不斷變化的。
<f:for each="{dce:fal(field:’myImages’, contentObject:contentObject)}" key="n" as="fileReference" iteration="iterator" >
<f:if condition="{n}==0">
<f:then>
<a href='<f:uri.image src="{fileReference.uid}" treatIdAsReference="1" />' rel="gallery" title="Terrassendach" class="" >
<f:image src="{fileReference.uid}" alt="" treatIdAsReference="1" class="img-responsive cgallery" />
</a>
</f:then>
<f:else>
<a href='<f:uri.image src="{fileReference.uid}" treatIdAsReference="1" />' rel="gallery" title="Terrassendach" class="" >
</a>
</f:else>
</f:if>
</f:for>
也許有人知道我做錯了什麼。
謝謝大家。
檢查'typo3temp/logs /'下的日誌文件,它應該在錯誤的日誌條目中包含字符串'20170309155903dbbf0d11'。 – Jost
謝謝,不知道。所以我發現異常: {「exception」:「InvalidArgumentException:參數\」每個\「註冊類型\」數組\「,但在視圖助手\」TYPO3 \\ \ CMS \\ Fluid \\ ViewHelpers \\ ForViewHelper \「in \/homepages \/7 \/d82759675 \/htdocs \ ... 但我不知道爲什麼,我在例子中做了同樣的處理 –
這通常是意味着''循環的'each'參數的語法是不正確的。在你的情況下,'myImages'周圍的單引號看起來很奇怪 - 它們不是正常的('''),而是其他的東西(向前打鉤?) –
Jost