我尝试使用 VHS(版本 2.4.0) RandomViewHelper 输出 1 个随机图像v:iterator.random
。
这是我的代码:
{namespace flux=FluidTYPO3\Flux\ViewHelpers}
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<f:layout name="Content" />
<f:section name="Configuration">
<flux:form id="random-image" label="Random Image" options="{icon: 'Icons/Content/Example.gif', group: 'Joya'}">
<flux:field.input name="classname" label="Classname" />
</flux:form>
<flux:form.section name="images" label="Images">
<flux:form.object name="image" label="Image">
<flux:field.file name="imagesrc" label="Image" allowed="png,jpg" maxItems="1" size="1" />
</flux:form.object>
</flux:form.section>
</f:section>
<f:section name="Preview">
Random Image
</f:section>
<f:section name="Main">
<div class="random-image">
<v:iterator.random as="img" subject="{images}">
{img.image.imagesrc}
</v:iterator.random>
</div>
</f:section>
我添加了 3 张图像进行测试,但它总是输出相同的图像。 编辑:随机的输出被缓存。所以它在缓存被清除后输出另一个图像。
我可以只为这行代码禁用缓存吗?
https://fluidtypo3.org/viewhelpers/vhs/2.4.0/Iterator/RandomViewHelper.html