0

I'm using Typo3 10.4.

I want to load the contents of a text file that is stored in fileadmin directory (the storageUid = 1 and the file path is fileadmin/test.txt) in typoscript. I want to use the file path, not the sys_file Uid like in

lib.test = TEXT
lib.test.data = file:17:contents

Is there any way to do that using typoscript syntax?

  • Including files via TypoScript has IMO been widely removed due to security issues. Maybe it could work by using the file as a template of a `FLUIDTEMPLATE`-object But I'm not sure, if this can still be in fileadmin instead of being in a sitepackage) – Julian Hofmann Nov 18 '21 at 07:36

1 Answers1

0

I solved the problem by using FILES content object. I don't have any thoughts about the performance issues since I assume that it scans all the files in a folder rather than just loading the specific file. And, I hope that this CObject will not deprecate in the next version. :D

lib.test = FILES
lib.test.folders = PATH_TO_THE_FOLDER
lib.test.renderObj = TEXT
lib.test.renderObj {
    stdWrap.data = file:current:contents
    stdWrap.if {
      value.data = file:current:name
      equals = FILE_NAME
    }
}