Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define a variable with random values in Smarty

Tags:

html

smarty

I need to assign a variable which will be used to create the id label for some html elements.

And it needs to be unique.

I tried

{assign var=unique_id value=`10|mt_rand:20`}

and

{math equation='rand(10,100)'}

But I don't know how to use the result

I don't have any other ideas

like image 358
Daniel Luca CleanUnicorn Avatar asked Mar 23 '10 17:03

Daniel Luca CleanUnicorn


1 Answers

this is how you set and use a random value but that deoesn't mean it will be unique.

    {assign var=unique_id value=10|mt_rand:20}
    {$unique_id}

can you describe a bigger picture of what your doing ?

like image 113
mcgrailm Avatar answered Sep 29 '22 18:09

mcgrailm