title: Smarty Nested foreach loop question
body: <p>I am having trouble getting the below array to display properly in a smarty template file. If anyone can help point me in the right direction I would be most thankful. </p>
  
  <p>my template code looks like this:</p>
  
  <pre><code>          {foreach from=$trackingGroups item=gender key=k item=v}
            {assign var=tc value="`$v.id`"}    
            {$v.title} ({$v.productCount})&lt;br /&gt;
  </code></pre>
  
  <p>{foreach item=department from=$trackingGroups.$tc item=v2}
              {$v2.title}<br />
              {/foreach}
                {/foreach}</p>
  
  <p>but the page displays like this:</p>
  
  <pre><code>          Women (3)&lt;br /&gt;
             W&lt;br /&gt;
                      7&lt;br /&gt;
                      3&lt;br /&gt;
                      Footwear&lt;br /&gt;
                      Accessories&lt;br /&gt;
  
            Men (2)&lt;br /&gt;
             M&lt;br /&gt;
                      7&lt;br /&gt;
                      2&lt;br /&gt;
                      Footwear&lt;br /&gt;
  
  
  
  
  Array
  </code></pre>
  
  <p>(
      [71] => Array
          (
              [title] => Women
              [id] => 71
              [productCount] => 3
              [171] => Array
                  (
                      [id] => 171
                      [title] => Footwear
                      [productCount] => 2
                      [74] => Array
                          (
                              [id] => 74
                              [title] => Boots
                              [productCount] => 2
                          )</p>
  
  <pre><code>            )
  
          [172] =&gt; Array
              (
                  [id] =&gt; 172
                  [title] =&gt; Accessories
                  [productCount] =&gt; 1
                  [74] =&gt; Array
                      (
                          [id] =&gt; 74
                          [title] =&gt; Boots
                          [productCount] =&gt; 1
                      )
  
              )
  
      )
  
  [72] =&gt; Array
      (
          [title] =&gt; Men
          [id] =&gt; 72
          [productCount] =&gt; 2
          [171] =&gt; Array
              (
                  [id] =&gt; 171
                  [title] =&gt; Footwear
                  [productCount] =&gt; 2
                  [74] =&gt; Array
                      (
                          [id] =&gt; 74
                          [title] =&gt; Boots
                          [productCount] =&gt; 2
                      )
  
              )
  
      )
  </code></pre>
  
  <p>)</p>