【发布时间】:2012-06-19 06:57:08
【问题描述】:
我想在我的 foreach 循环中获得一个带有项目 id 的 var。 我想尝试的(只是演示代码)如下,但它只是给我一个错误。
php
$this->smarty->assign(array(
'demo' => array(
'foo_bar' => 'succeed!',
'foo_seat' => 'succeed also!'
),
'bar' => 'bar',
'seat' => 'seat'
));
tpl
value="{$demo.foo_{$bar}}"
错误
Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "application/views/overzicht/selectie.tpl" on line 55 "{$demo.foo{$bar}}" - Unexpected "{", expected one of: "}"
谁有想法?
【问题讨论】: