0
私は$additional_infos
という名前のarray
をphpファイルからスマートテンプレートファイルに割り当てます。スマートテンプレートのネストされた項目とキーを持つ配列のキーと値にアクセスしますか?
foreach ($results as $row) {
$additional_infos[] = array('informations_client' => $row['informations_client'], 'field_type' => $row['field_type']);
}
アレイプリントは、私はこのようなテンプレートでこれを表示することができ、この
Array
(
[0] => Array
(
[informations_client] => Nom
[field_type] => 1
)
[1] => Array
(
[informations_client] => Prénom
[field_type] => 1
)
[2] => Array
(
[informations_client] => Adresse
[field_type] => 2
)
)
のようなものです:私は希望
informations_client: Nom
field_type: 1
informations_client: Prénom
field_type: 1
:
{foreach name=outer item=contact from=$additional_infos}
<hr />
{foreach key=key item=item from=$contact}
{$key}: {$item}<br />
{/foreach}
{/foreach}
それは正常に動作しますに直接アクセスするまたはfield_typ
eですが、スマートなエラーがあります。
私は私はそれをどのように行うことができます。この{$item. field_type}
のようなものを使用したいですか?
をあなたは{[「field_type」] $アイテムを}使用することができます –
@PavelPetrov私はこれに時間を費やし、最終的にはSOにいくつかの助けを見つけることにしました。ちょうど私の質問をした直後に、私はこれを1つのforeachで直接アクセスできることを発見しました。 '{$ contact.informations_client}' –