tags:

views:

35

answers:

1

This is what I would like to do:

I have assigned the following items:

$smarty->assign('seats', $aantalStoeltjes);
$smarty->assign('taken', $bezetArray);

"seats" is the number of seats available. This is an array with only one item. The number 150 in this case but is dynamic. "taken" is the seats that are already taken and should not be displayed. This is also an array with several items in it like movietitle, play day, etc. The taken seats are assigned to "seatnumber".

What I need is to let smarty to add foo 150 times (in this case). If the seat's number is equal to the taken number the foo should not be added.

So to sum it up. foo should be added 150 times in this case, but if the number is equal to one of the seatnumbers in the "taken" array it should be skipped.

This is what I tried:

{section start=1 loop=$seats+1 step=1}
    {foreach from=$taken item=tolate}
        {if $smarty.section.seats.index !=  $tolate.seatnumber}
        <p>{$tolate.seatnumber}</p>
        <p>{$smarty.section.seats.index}</p>
        {/if}
    {/foreach}
{/section}

but this doesn't work correctly. Can anyone help me?

A: 

It would be much simple if you would use this:

{foreach from=$taken item=tolate} 
    {if $tolate.seatnumber != $seats} 
          <p>{$tolate.seatnumber}</p> 
          <p>{$seats}</p> 
    {/if} 
{/foreach} 
Zsolti