Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

foreach dla list ul

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Polish
View previous topic :: View next topic  
Author Message
halogenick
Smarty n00b


Joined: 21 Apr 2013
Posts: 1

PostPosted: Sun Apr 21, 2013 5:03 pm    Post subject: foreach dla list ul Reply with quote

Siema, mój pierwszy post tutaj, więc sorry za ewentualne błędy Smile

Nie mogę rozgryźć jak napisać pętle gdzie przykładowo:

mam pętle:


Code:
<ul>
{foreach from=$new_products item='product' name='newProducts'}
<li>zmienne... itp</li>
{/foreach}
</ul>



wtedy generuje się:
Code:

<ul>
<li>zmienne... itp</li>
<li>zmienne... itp</li>
<li>zmienne... itp</li>
<li>zmienne... itp</li>
<li>zmienne... itp</li>
<li>zmienne... itp</li>
<li>zmienne... itp</li>
</ul>


Jednak, chcę podzielić te li na jakby grupy po 4 LI w jednym UL czyli:

Code:
<ul>
<li>zmienne... itp</li>
<li>zmienne... itp</li>
<li>zmienne... itp</li>
<li>zmienne... itp</li>
</ul>
<ul>
<li>zmienne... itp</li>
<li>zmienne... itp</li>
<li>zmienne... itp</li>
</ul>


itd...

Rozumiem, że najpierw musi być pętla, która zliczy mi wszystkie obiekty w pętli (np. ilość produktów)
Później musi być pętla, która podzieli te 'produkty' po 4 i pogrupuje je w osobnych UL


Macie może jakieś rozwiązanie? Próbuję już od 4 godzin, w końcu się poddałem... Sad
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Polish All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP