Smarty multiple random numbers list
Posted
by Heinrich
on Stack Overflow
See other posts from Stack Overflow
or by Heinrich
Published on 2010-04-07T12:09:08Z
Indexed on
2010/04/07
12:13 UTC
Read the original article
Hit count: 307
Hey Stackoverflow-Folks, is there any smart way to post random numbers (e.g. 1-4) in a list by using the smarty tpl-engine?
standart list sorted 1-5:
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
Here's my solution (PHP):
<ul>
{foreach from=randomNumbers}
<li>{smarty.randomNumbers}</li>
{/foreach}
</ul>
modified list sorted 1-5 (random):
<ul>
<li>3</li>
<li>2</li>
<li>5</li>
<li>1</li>
<li>4</li>
</ul>
I've really tested nearly everything, but I do only need a smart & small solution for this :-)
Kind Regards, Heinrich
© Stack Overflow or respective owner