0

我有一个包含 xml 文件的文件集合。

在我的流体模板中,我遍历文件。有没有办法从文件中提取 xml 并解码为流体数组,类似于 json-decode viewhelper,但使用文件引用作为参数?

我很感激任何提示。

提前谢谢,

4

1 回答 1

1

您可以在 Fluid 中通过注册自己的 ViewHelper 并使用 PHP 来做到这一点。请参阅https://docs.typo3.org/m/typo3/book-extbasefluid/master/en-us/8-Fluid/8-developing-a-custom-viewhelper.html

在视图之外执行此操作可能是更好的做法。根据流体的渲染方式,可能在 Extbase 控制器中,或者在自定义 DataProcessor 中的 TypoScript/FLUIDTEMPLATE 的情况下(https://docs.typo3.org/m/typo3/reference-typoscript/master/en-我们/ContentObjects/Fluidtemplate/Index.html#dataprocessing)。

要将您的 FileReference-uid 转换为数据,请查看此处:https ://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Fal/UsingFal/ExamplesFileFolder.html

于 2020-02-05T18:17:05.467 回答