Home > Mobile >  Typo3: Load HTML File with ViewHelper from Directory
Typo3: Load HTML File with ViewHelper from Directory

Time:09-17

I got several directories in my typo3 fileadmin, from which i want to load certain filetypes at certain points in my code. In this folder are files like, images, audio files and HTML file. With a for loop i'm iterating over the files and depending on the file type (https://blog.pixel-ink.de/dateitypen-fal/) the file gets rendered. It works perfectly fine for image and other media files, but i'm having problems displaying the HTML-File correctly. This is what i got:

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

The HTML-File is in the {file} variable, but i really don't know how to exctract the raw HTML Text from it. I did also check the typo3 documentation for format.html (https://docs.typo3.org/other/typo3/view-helper-reference/9.5/en-us/typo3/fluid/latest/Format/Html.html) but it was no help either. Has anybody suggestions?

For information: The HTML-File only contains a article-Tag with many paragraphs. Also here is the for loop that outputs images, which works perferctly:

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

CodePudding user response:

you can use {file.contents -> f:format.raw()}

  • Related