参数 "each" 注册为 "array" 类型,但在视图帮助器中为 "string" 类型
The argument "each" was registered with type "array", but is of type "string" in view helper
我正在尝试进行错字 3 扩展,我想显示区域中的所有关系(在本例中为城市)。我像这样在 kickstarter 中将它们连接起来:
我试图打印区域单一视图中的城市,这样做:
<table class="tx-collection-plan" >
<tr>
<td>
<f:translate key="tx_collectionplan_domain_model_region.name" />
</td>
<td>
{region.name}
</td>
</tr>
<tr>
<td>
<f:translate key="tx_collectionplan_domain_model_region.cities" />
</td>
<td>
<ul>
<f:for each="{region.cities)" as="city">
<li>{city.name}</li>
</f:for>
</ul>
</td>
</tr>
</table>
但是我一直收到这个错误:
糟糕,发生错误!
参数 "each" 注册为类型 "array",但在视图助手 "TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper" 中的类型为
"string"
是否有另一种解决方案来显示一个区域的所有子部分(带有可以点击的链接 -> 就像城市本身的列表视图)?
EDIT: when i remove the for loop and just print city.name, i only get
the dot from li .... but nothing else
我找到了解决方案:
我只需要
<table class="tx-collection-plan" >
<tr>
<td>
<f:translate key="tx_collectionplan_domain_model_region.name" />
</td>
<td>
{region.name}
</td>
<td>
<f:for each="{region.cities}" as="city">
{city.name}
</f:for>
</td>
</tr>
</table>
<f:translate>
是不必要的
我正在尝试进行错字 3 扩展,我想显示区域中的所有关系(在本例中为城市)。我像这样在 kickstarter 中将它们连接起来:
<table class="tx-collection-plan" >
<tr>
<td>
<f:translate key="tx_collectionplan_domain_model_region.name" />
</td>
<td>
{region.name}
</td>
</tr>
<tr>
<td>
<f:translate key="tx_collectionplan_domain_model_region.cities" />
</td>
<td>
<ul>
<f:for each="{region.cities)" as="city">
<li>{city.name}</li>
</f:for>
</ul>
</td>
</tr>
</table>
但是我一直收到这个错误:
糟糕,发生错误!
参数 "each" 注册为类型 "array",但在视图助手 "TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper" 中的类型为
"string"
是否有另一种解决方案来显示一个区域的所有子部分(带有可以点击的链接 -> 就像城市本身的列表视图)?
EDIT: when i remove the for loop and just print city.name, i only get the dot from li .... but nothing else
我找到了解决方案:
我只需要
<table class="tx-collection-plan" >
<tr>
<td>
<f:translate key="tx_collectionplan_domain_model_region.name" />
</td>
<td>
{region.name}
</td>
<td>
<f:for each="{region.cities}" as="city">
{city.name}
</f:for>
</td>
</tr>
</table>
<f:translate>
是不必要的