I don't know if this is the best forum for it, but hopefully someone will be able to give me some help with this.
I have an array, that upon print_r looks something like this:
Array ( [0] => Array
( [field1] => form one [field2] => p3 [field3] => Content Sample A )
[1] => Array
( [field1] => form one [field2] => p5 [field3] => Content Sample B
( [subfield] => Array
( [0] => Somevalue [1] => Another Value [2] => A third example )
)
)
)
I'm trying to print out the elements in the subfield array using nested foreach statements, but I must be doing it wrong, because it's not outputting anything.
This is what I tried:
{foreach from="$myVar" key="key" item="firstarray"}
{foreach from="$firstarray" key="key2" item="secondarray"}
{if $secondarray == 'subfield'}
{foreach from="$secondarray" key="key3" item="thirdarray"}
SUBFIELD : Key: {$key3} - Value: {$thirdarray}<br />
{/foreach}
{else}
Key: {$key2} - Value: {$secondarray}<br />
{/if}
{/foreach}
{/foreach}