0

我找到了我想为自己使用的这个很酷的解决方案。(示例)这是一个如何使用 FAL 和 DCE 来获取多个图像的示例。

如果我尝试此解决方案,我将在我的网站上收到以下错误输出:

糟糕,发生错误!代码: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>

也许有人知道我做错了什么。

谢谢你们。

4

1 回答 1

0

在最新错误之后:

代码:20170309184102e296c357 - {"exception":"TYPO3\CMS\Fluid\Core\Parser\Exception: 无法解析命名空间。永远不应抛出此异常!在 /homepages/7...

我再次添加了来自 dce 的标准命名空间,我自己删除了它。

{namespace dce=ArminVieweg\Dce\ViewHelpers}
<f:layout name="Default" />
 ....
</f:section>

所以我自己的错误。

于 2017-03-09T19:15:45.317 回答