foreach in a foreach

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
papagot1
Forum Members
Forum Members
Posts: 13
Joined: Sat Mar 03, 2012 9:45 pm

foreach in a foreach

Post by papagot1 »

Good night to all ... I hope very much for your help ...
Is there a standard {foreach from = $ nodelist item = node} I need this to drive an array of foreach with classes. here's what I got. It displays all elementy as many times as there are in the array elementov. and so every element duplicates the menu. I need so that the first element of the first menu, go to the second element classes 2 and so on .... here is an example http://vartiprof.prior24.com/index.php?page=about-us
papagot1
Forum Members
Forum Members
Posts: 13
Joined: Sat Mar 03, 2012 9:45 pm

Re: foreach in a foreach

Post by papagot1 »

This is the code that I have turned ...

Code: Select all

{if $count > 0}
{foreach from=$nodelist item=node}
{if $node->haschildren == 'true'}
{foreach from=$items key=myId item=i}
<a id="{$myId}" href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}>
{$myId}
 {$node->menutext}</a>
{/foreach}
{else}
<div class="sub">
<ul class="l1">
<li>
<a href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}>{$node->menutext}</a>
</li>
</ul>
</div>
{/if}
{/foreach}{/if}
Post Reply

Return to “The Lounge”