如何在 TYPO3 中使用 VHS 将文件名拆分为不同的部分
How to split a filename into different parts with VHS in TYPO3
从文件夹中获取文件名后,我想将其拆分成多个部分以在 Fluid-template 中显示各个部分。
文件名:
My-super-song_My-Name_1.1.2019.mp3
应该像这样格式化为 HTML:
<span>My super song</span> recorded by <span>My name</span> at <span>1.1.2019</span>
我使用 VHS 查看助手删除文件的 .mp3:
<v:format.replace substring=".mp3" content="{file.name}" replacement="" count="123"></v:format.replace>
VHS中有没有视图助手可以实现拆分?
非常感谢!
感谢 Mathias Brodola,这里是可用的代码,非常感谢!
<v:iterator.explode content="{file.name}" glue="_" as="song">
<!-- Shows all exploded strings for testing purposes
<f:for each="{song}" as="iter">
<pre>{iter}</pre>
</f:for>
-->
<h2>{song.0}</h2>
<p>Date:
<v:format.replace substring=".mp3" content="{song.1}" replacement=""></v:format.replace></p>
</v:iterator.explode>
从文件夹中获取文件名后,我想将其拆分成多个部分以在 Fluid-template 中显示各个部分。
文件名: My-super-song_My-Name_1.1.2019.mp3
应该像这样格式化为 HTML:
<span>My super song</span> recorded by <span>My name</span> at <span>1.1.2019</span>
我使用 VHS 查看助手删除文件的 .mp3:
<v:format.replace substring=".mp3" content="{file.name}" replacement="" count="123"></v:format.replace>
VHS中有没有视图助手可以实现拆分? 非常感谢!
感谢 Mathias Brodola,这里是可用的代码,非常感谢!
<v:iterator.explode content="{file.name}" glue="_" as="song">
<!-- Shows all exploded strings for testing purposes
<f:for each="{song}" as="iter">
<pre>{iter}</pre>
</f:for>
-->
<h2>{song.0}</h2>
<p>Date:
<v:format.replace substring=".mp3" content="{song.1}" replacement=""></v:format.replace></p>
</v:iterator.explode>