如何在 Fluid Typo3 中访问页面的资源文件

How to access Page's Resources files in Fluid Typo3

Page's Resources Tab

我一直在尝试访问这些文件,但没有成功。感谢任何帮助。

如果您的系统安装了 EXT:vhs,您可以像这样通过 vhs viewhelper 获取它,

{namespace v=FluidTYPO3\Vhs\ViewHelpers}

<v:page.resources.fal table="pages" field="media" uid="{page.uid}" as="images" slide="-1" >
    <f:for each="{images}" as="image">
        <f:image src="{image.url}" alt="{image.alternative} {image.name}" title="{image.title}" />
    </f:for>
</v:page.resources.fal>

您可以从这里获得更多相关信息:https://github.com/FluidTYPO3/vhs/pull/395 and https://fluidtypo3.org/viewhelpers/vhs/2.3.3/Page/Resources/FalViewHelper.html#argument-slide

您也可以使用 typoscrpt 解决方案,

lib.pageResources = FILES 
lib.pageResources { 
    references { 
        table = pages 
        uid.data = uid
        fieldName = media
    } 
    renderObj = IMAGE 
    renderObj {
        file { 
            import.data = file:current:uid 
            treatIdAsReference = 1 
            width = 150c 
            height = 150c 
        } 
        altText.data = file:current:alternative
        titleText.data = file:current:title
    }
    maxItems = 3
}

渲染:

<f:cObject typoscriptObjectPath="lib.pageResources" />

您可以从这里获得更多相关信息:https://riptutorial.com/typo3/example/21734/image-and-image-resource

希望这对您有所帮助... #KeepCoding.. ;)

此致

如果喜欢TYPO3 Fluid中的Page Resources文件/图片,举个例子:

<f:if condition="{files}">
    <f:then>
        <f:for each="{files}" as="image">
            <f:uri.image image="{image}" />
        </f:for>
    </f:then>
</f:if>

所有页面资源文件/图像都在“文件”中找到您。采取 <debug>{_all}</debug>