I have an array which I created in php with a recursive function, I do not know how many dimensions, how can I use in Smarty ?
I trying use this code :
{foreach $myArr as $items}
<li>
{$items.title}
{if $item.submenu}
<ul>
{foreach $items.submenu as $items2}
<li>{$items2.title}</li>
{/foreach}
</ul>
{/if}
</li>
{/foreach}
But this code is for just 2 levels, may be my array have 3 or 4 or ... levels.
UPDATE:
I found the solution, in my solution I use Smarty functions :
{function name=menu level=0}
<ul>
{foreach $data as $items}
<li>
<a href="{$items.url}">
{$items.title}
</a>
{if is_array($items.submenu)}
{menu data=$items.submenu level=$level+1}
{/if}
</li>
{/foreach}
</ul>
{/function}
{menu data=$menuItems}