|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Buster Smarty n00b
Joined: 29 Apr 2008 Posts: 1
|
Posted: Tue Apr 29, 2008 7:19 pm Post subject: Przerwanie petli foreach |
|
|
Witam.
Jako, że jestem nowy, to chciałem się przywitać i wszystkich pozdrowić. No a, teraz do rzeczy. Jest sobie taki kawałek kodu:
Code: |
{foreach from=$kategorie item=k name=petla}
<tr>
{foreach from=$katzaz item=kz}
{if $kz.id_kategorii eq $k.id} {assign var='check' value='true'} {else} {assign var='check' value='false'} {/if}
{/foreach}
<td>
<input type="checkbox" name="kat[{$smarty.foreach.petla.index}]" value="{$k.id}" {if $check eq 'true'} checked="checked" {/if}/> {$k.nazwa_kategorii}
</td>
<td>
<label for="il[{$smarty.foreach.petla.index}]">Ilość zdjęć: </label><input type="text" name="il[{$smarty.foreach.petla.index}]" {if $check eq 'true'}value="{$kz.ilosc_zdjec}"{/if} />
</td>
</tr>
{/foreach}
|
Interesuje mnie, czy jest możliwość, przerwania działania tej wewnętrznej pętli foreach, w przypadku gdy warunek jest prawdziwy??? |
|
Back to top |
|
fornve Smarty Rookie
Joined: 25 Apr 2008 Posts: 29 Location: Sheffield, UK
|
Posted: Sat May 03, 2008 9:00 am Post subject: |
|
|
Siema,
w wewnetrznej petli piszesz
{if $warunek}
{assign $smarty.foreach.petla.index=$smarty.foreach.petla.last}
{/if}
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|