我关注了分配给 smarty 模板的数组标题 $value。
Array
(
[id] => 175
[start_date] => 2014-07-01
[end_date] => 2014-07-31
[count] => 3
[rebate_type_id] => 2
[created_at] => 1406031299
[updated_at] => 1406031299
[applicable_states] => Array
(
[0] => Array
(
[state_id] => 0
[rebate_id] => 175
[state_name] => All States
)
)
[manufacturer_id] => 49
[company_name] => Blue Nun
[manufacturer_image_path] =>
)
为了访问内部数组元素,我编写了以下代码,但它不起作用。你能纠正我在下面的代码中犯的错误吗?
{if $value.appplicable_states.0.state_name == 'All States'}
All States
{/if}