1

I would like to expand the content element "menu of subpages" with images from page resources.

In TYPO3 8.7 the following code did everything i needed:

<f:if condition="{menu}">
    <ul class="pagemenu-img">
        <f:for each="{menu}" as="page">
            <li>
                <a href="{page.link}"{f:if(condition: page.target, then: ' target="{page.target}"')} title="{page.title}">
                    <f:image src="fileadmin/{page.files.0.originalFile.identifier}" />
                    <span>{page.title}</span>
                </a>
            </li>
        </f:for>
    </ul>
</f:if>

With TYPO3 10.4 this isn't working anymore.
Is there another way? Preferably without using VHS.

4

2 回答 2

1

它仍在工作。

我已经测试了您的 HTML 模板,结果符合预期: 在此处输入图像描述

您的问题似乎是其他问题...

于 2020-11-26T19:31:54.370 回答
0

也许有些页面没有任何图像......

因此,您应该检查是否存在图像:[并摆脱硬编码的 fileadmin/ 链接<只需使用{page.files.0.originalFile}]

<f:if condition="{menu}">
    <ul class="pagemenu-img">
        <f:for each="{menu}" as="page">
            <li>
                <a href="{page.link}"{f:if(condition: page.target, then: ' target="{page.target}"')} title="{page.title}">

                    <f:if condition="{page.files.0}">
                        <f:image image="{page.files.0.originalFile}" />
                    </f:if>

                    <span>{page.title}</span>
                </a>
            </li>
        </f:for>
    </ul>
</f:if>
于 2021-01-14T11:52:54.787 回答