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

Wyswietlanie wynikow z warunkiem

 
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
belko
Smarty n00b


Joined: 26 Jun 2010
Posts: 2

PostPosted: Sat Jun 26, 2010 4:50 pm    Post subject: Wyswietlanie wynikow z warunkiem Reply with quote

Witam.

Pobieram z bazy danych pewne dane, które następnie wyświetlam w tabeli.

I teraz pytanie, w jaki sposób za pomocą Smarty rozpoznać, że aktualnie wypisywana wartość jest inna od poprzedniej?

Potrzebne jest mi to, aby oddzielić następująca po sobie różniące się dane.
Back to top
View user's profile Send private message
fornve
Smarty Rookie


Joined: 25 Apr 2008
Posts: 29
Location: Sheffield, UK

PostPosted: Sat Sep 04, 2010 11:20 pm    Post subject: Reply with quote

Zakladajac ze mamy objekty w tablicy ( mysqli_fetch_object ) i porownujemy ceny
Code:

{foreach from=$data item=row loop=data_loop}
   {if !$smarty.foreach.data_loop.first && $row->price != $last_price}
   <p>Nie pierwszy element i zmiana ceny</p>
   {/if}
   {assign var=last_price value=$row->price}
{/foreach}


Pozdrawiam,
Marek
Back to top
View user's profile Send private message Visit poster's website
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