Matthew Colley
Matthew Colley

Reputation: 11446

Smarty Display Array Values

I have the following array that I would like to display in Smarty:

->value = Array (2)
 0 => Array (1)
 0 => Array (4)
  SiteName => "USA"
  SanctionID => "41470"
  Program => "Men"
  Amount => "5.00"
 1 => Array (1)
  0 => Array (4)
  SiteName => "USA"
  SanctionID => "41471"
  Program => "Men"
  Amount => "5.00"

I am using two foreach loops, but am unable to get the values to display. appreciate any assistance.

{foreach from=$SXid item=Amount key=SiteName}
    {foreach from=$SXid[sxid] item=Amount key=SiteName}
        <tr>
            <td></td>
            <td>{$Amount} is {$SiteName}</td>
            <td></td>
        </tr>
    {/foreach}
{/foreach}

Upvotes: 0

Views: 704

Answers (1)

rodneyrehm
rodneyrehm

Reputation: 13557

try

{foreach from=$SXid item="outer" key="outer"}
    {foreach from=$outer item="value" key="key"}
        <tr>
            <td></td>
            <td>{$key|escape} =&gt; {$value|escape}</td>
            <td></td>
        </tr>
    {/foreach}
{/foreach}

Upvotes: 1

Related Questions