typo3 - 在for循环中流体访问其他数组

标签 typo3 fluid extbase

我必须像这样排列:

$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/

相关文章:

typo3 - 如何在流体中分配变量?

css - 3 个嵌套 div - 父级固定宽度,基于内容的左右宽度,空中心宽度等于差异?

TYPO3:禁用特定插件/扩展的缓存

php - 打字错误 extbase : is there a way to map exec_SELECTgetRows results to entities?

html - CSS 'clear:both;"在 IE7 浏览器中无法正常工作。在 IE8/IE9、Firefox、Chrome 等中没有问题

controller - 当我尝试在 TYPO3 版本上安装自定义扩展时出现错误,如何解决? 10?

typo3 - 使用 Hook 在后端显示 flash 消息以某种方式不起作用

typo3 - Fluidtypo3 Flux - 保存在表字段中

typo3 - 如何让前端布局确定列和后端布局?

typo3 - 在 Extbase 6.2 中,列表页面不再使用 uid