|
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 |
eadz Smarty Regular
Joined: 30 Apr 2003 Posts: 61 Location: Auckland, New Zealand
|
Posted: Wed Apr 30, 2003 1:22 pm Post subject: {loop} ? |
|
|
Hi there,
I have a varible :
$Smarty->assign("num", 10);
What I would like to do is
Number of stars : {loop count=$num}*{/loop}
and have 10 stars.
But I cannot see a loop function in the docs. What is the alternative function? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Apr 30, 2003 1:25 pm Post subject: |
|
|
{section loop=$num}
...
{/section} |
|
Back to top |
|
eadz Smarty Regular
Joined: 30 Apr 2003 Posts: 61 Location: Auckland, New Zealand
|
Posted: Wed Apr 30, 2003 1:33 pm Post subject: |
|
|
Hmm it works for arrays, and just a number of loops!!
fancy.
Although your example didn't work :
Fatal error: Smarty: [in footer.html line 4]: syntax error: missing section name (Smarty_Compiler.class.php, line 900)
But this does :
Code: |
php :
$Smarty->assign("nn",10);
template:
{section name=n loop=$nn}
*
{/section}
|
thanks for the help |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Apr 30, 2003 2:34 pm Post subject: |
|
|
ah yeah, name attribute required. |
|
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
|