0
votes

I found this cool solution which i want to use for myself. (Example) It is an example how to use the FAL with the DCE to get multiple images.

If I try this solution I will get the following error output on my website:

Oops, an error occurred! Code: 20170309155903dbbf0d11

Sometimes I get nothing out, no error no images.

That my solution in detail: I use a File Abstract layer with the same configuration, except the last two lines:

<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>

My field name is myImages. So the variable name is set correct. The only difference between my code and the example are the last two lines. But nothing is changing when I delete this two lines:

<dce_load_schema>1</dce_load_schema>
<dce_get_fal_objects>1</dce_get_fal_objects>

In my template I use this code to get my images.

            <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>

Maybe someone has an idea what I'm doing wrong.

Thank you all.

1
Check the log files under typo3temp/logs/, it should contain the string 20170309155903dbbf0d11 in the log entry for your error. - Jost
Thank you, did not known that. So i found that Exception: {"exception":"InvalidArgumentException: The argument \"each\" was registered with type \"array\", but is of type \"string\" in view helper \"TYPO3\\CMS\\Fluid\\ViewHelpers\\ForViewHelper\" in \/homepages\/7\/d82759675\/htdocs\... But i have no idea why. I did the same like in the example. - Mando Statti
This usually means that the syntax of the each argument of a <f:for> loop is incorrect. In your case, the single quotation marks around myImages seem odd - they are not the normal ones ('), but rather something else (forward tick?) - Jost
you are right the odd was wrong. But now i get another code-error: Code: 20170309184102e296c357 - {"exception":"TYPO3\\CMS\\Fluid\\Core\\Parser\\Exception: Namespace could not be resolved. This exception should never be thrown! in \/homepages\/7\... - Mando Statti
That means you are missing a {namespace x=Foo\Bar\ViewHelpers} statement at the beginning one of your fluid templates. - Jost

1 Answers

0
votes

After the latest error:

Code: 20170309184102e296c357 - {"exception":"TYPO3\CMS\Fluid\Core\Parser\Exception: Namespace could not be resolved. This exception should never be thrown! in /homepages/7...

I added again the standard-namespace from dce, which i deleted myself.

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

So my own mistake.