Nathan Nathan - 1 year ago 133
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>

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

Answer Source

A single loop would work -

{foreach from=$clientProjects item=Array}
    <option value="{$Array.pw_pro_Code}">{$Array.pw_pro_Code}</option>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download