【问题标题】:Typo3: Load HTML File with ViewHelper from DirectoryTypo3:使用 ViewHelper 从目录加载 HTML 文件
【发布时间】:2021-11-10 07:39:51
【问题描述】:

我的typo3 文件管理中有几个目录,我想在我的代码中的某些点加载某些文件类型。在这个文件夹中是文件,如图像、音频文件和 HTML 文件。使用 for 循环,我将遍历文件并根据文件类型 (https://blog.pixel-ink.de/dateitypen-fal/) 渲​​染文件。它适用于图像和其他媒体文件,但我在正确显示 HTML 文件时遇到问题。这是我得到的:

<f:for each="{mkk:getFilesInFolder(dir:'/stories/test1/')}" as="file">
   <f:if condition="{file.properties.type} == 1">
      <f:format.html>{file}</f:format.html>
   </f:if>
</f:for>

HTML 文件位于 {file} 变量中,但我真的不知道如何从中提取原始 HTML 文本。我还检查了格式.html (https://docs.typo3.org/other/typo3/view-helper-reference/9.5/en-us/typo3/fluid/latest/Format/Html.html) 的typo3 文档,但这也没有帮助。有没有人建议?

有关信息:HTML 文件仅包含一个带有许多段落的文章标签。这里还有输出图像的 for 循环,效果很好:

<f:for each="{mkk:getFilesInFolder(dir:'/stories/test1/')}" as="file">
   <f:if condition="{file.properties.type} == 2">
      <f:image image="{file}" class="story-diashow-img" />
  </f:if>
</f:for>

【问题讨论】:

    标签: html typescript file frontend typo3


    【解决方案1】:

    你可以使用{file.contents -&gt; f:format.raw()}

    【讨论】:

    • 谢谢哥们,这正是我正在寻找的。太棒了!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-08
    • 1970-01-01
    • 1970-01-01
    • 2013-05-25
    • 2018-05-12
    • 1970-01-01
    相关资源
    最近更新 更多