0
我想修改Prestashop 1.6.1.5中的模块。我通过foreach循环在smarty上打印价值。smarty多维数组如何打印值
我有智者阵列$obchody
Array
(
[0] => Array
(
[id] => 2
[active] => 1
[mesto] => Praha
[vzdalenost] => 86
[name] => Praha - rozvoz
[address1] => Praha
[address2] =>
[postcode] => 10200
[latitude] => 25.94896900
[longitude] => -80.22643900
[hours] => a:7:{i:0;s:0:"";i:1;s:0:"";i:2;s:0:"";i:3;s:0:"";i:4;s:0:"";i:5;s:0:"";i:6;s:0:"";}
[phone] =>
[fax] =>
[note] =>
[email] =>
)
[1] => Array
(
[id] => 3
[active] => 1
[mesto] => Aš
[vzdalenost] => 133
[name] => Aš - rozvoz
[address1] => Aš
[address2] =>
[postcode] => 35201
[latitude] => 25.94896900
[longitude] => -80.22643900
[hours] => a:7:{i:0;s:0:"";i:1;s:0:"";i:2;s:0:"";i:3;s:0:"";i:4;s:0:"";i:5;s:0:"";i:6;s:0:"";}
[phone] =>
[fax] =>
[note] =>
[email] =>
)
[2] => Array
(
[id] => 1
[active] => 1
[mesto] => Liberec
[vzdalenost] => 192
[name] => Liberec - rozvoz
[address1] => Liberec
[address2] =>
[postcode] => 46001
[latitude] => 25.94896900
[longitude] => -80.22643900
[hours] => a:7:{i:0;s:0:"";i:1;s:0:"";i:2;s:0:"";i:3;s:0:"";i:4;s:0:"";i:5;s:0:"";i:6;s:0:"";}
[phone] =>
[fax] =>
[note] =>
[email] =>
)
)
,我试图让[name]
值在我的模板,
{foreach $obchody as $obchod}
{$obchod->name}
{/foreach}
但我总是只注意到“通知:试图获取属性非...中的对象...“。我试过{$obchod[0]->name}
,结果相同。我究竟做错了什么?
@Reginol_Blindhop你试过阅读Smarty的[documentation](https://www.smarty.net/docs/en/language.variables.tpl)吗? – axiac