Nathan Nathan - 3 months ago 6
Smarty Question

Data from associative array in Smarty

I have an associative array and made a datadump of it (See picture)
enter image description here

With smarty I want the pw_pro_Code to be visible in a select list

{foreach from=$clientProjects item=Array}
{foreach from=$Array item=pw_pro_Code}
<option value="{$pw_pro_Code}">{$pw_pro_Code}</option>
{/foreach}
{/foreach}


But this shows me both pw_pro_code and pw_wc_InstanceId in list. What am I doing wrong?

Answer

A single loop would work -

{foreach from=$clientProjects item=Array}
    <option value="{$Array.pw_pro_Code}">{$Array.pw_pro_Code}</option>
{/foreach}