我必须像这样排列:
$business = array(0 => 'Car', 1 => 'IT');
$counts = array(0 => 15, 1 => 33);
我在我的流体模板中分配两个数组并迭代数组业务。
<f:for each="{business}" as="b" key="key">
<li>
<f:link.action action="business" arguments="{current_business: b.uid}">
<f:if condition="{counts.key} > 0">
<f:then>
{b.title} {counts.key}
</f:then>
<f:else>
{b.title}
</f:else>
</f:if>
</f:link.action>
</li>
</f:for>
我没有得到 {counts.key}
的输出,我应该通过其他方式访问它吗?
最佳答案
这可以使用 v:variable.get
-ViewHelper 来完成来自扩展 vhs
.而不是 {counts.key}
使用
{v:variable.get(name: 'counts.{key}')}
或
<v:variable.get name="counts.{key}"/>.
关于typo3 - 在for循环中流体访问其他数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32165074/