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

how to do a while ?

 
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 -> General
View previous topic :: View next topic  
Author Message
trollmdr
Smarty n00b


Joined: 28 Jul 2003
Posts: 4

PostPosted: Mon Jul 28, 2003 9:32 am    Post subject: how to do a while ? Reply with quote

hi,
sorry for my english but i got a question.
I want to do something like this with smarty template

echo "<table>";
while($i=0; $i<40;$i++{
echo "<tr><td>".$tab[$i]."</td></tr>";
}
echo "</table>";

Can you explain me plz how to do this with template because "while" function doesn't exist.

Marc.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Mon Jul 28, 2003 10:13 am    Post subject: Reply with quote

Code:
{section name=i loop=40}
<tr><td>{$tab[i]}</td></tr>
{/section}


or maybe:

Code:
{section name=i loop=$tab}
<tr><td>{$tab[i]}</td></tr>
{/section}


to dump not 40, but all elements of $tab.
this is all explained at:
http://smarty.php.net/manual/en/language.function.section.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website
trollmdr
Smarty n00b


Joined: 28 Jul 2003
Posts: 4

PostPosted: Mon Jul 28, 2003 10:37 am    Post subject: Reply with quote

thanks first solution is perfect for me
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 -> General 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