かめのはこ

とあるエンジニアのメモ帳です

smartyでランダム関数を利用する

※rand自体はphpの関数をそのまま利用できる

{assign var=hoge value=1|rand:3}
 
 //"1|rand:3" の部分は "rand(1,3)" に解釈される

 
【参考】
※[php]rand関数
 http://php.net/manual/en/function.rand.php
※[smarty]修飾子について
 http://www.smarty.net/docsv2/ja/language.modifiers.tpl