|
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 |
trollmdr Smarty n00b
Joined: 28 Jul 2003 Posts: 4
|
Posted: Mon Jul 28, 2003 9:32 am Post subject: how to do a while ? |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Mon Jul 28, 2003 10:13 am Post subject: |
|
|
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 |
|
trollmdr Smarty n00b
Joined: 28 Jul 2003 Posts: 4
|
Posted: Mon Jul 28, 2003 10:37 am Post subject: |
|
|
thanks first solution is perfect for me |
|
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
|