Smarty: Display a random sentence from array
- by Martind
I have a smarty template, that I want to display a random sentence on each reload. I could do it with this:
in php file:
$sentences = array('Hello you', 'Hi mate', 'Welcome');
shuffle($sentences);
$smarty->assign('sentence', $sentences[0]);
in template file:
<h1>{$sentence}</h1>
Is it possible to do all this in the template…