title: Smarty: Display a random sentence from array
body: <p>I have a smarty template, that I want to display a random sentence on each reload. I could do it with this:</p>
  
  <p>in php file:</p>
  
  <pre><code>$sentences = array('Hello you', 'Hi mate', 'Welcome');
  shuffle($sentences);
  $smarty-&gt;assign('sentence', $sentences[0]);
  </code></pre>
  
  <p>in template file:</p>
  
  <pre><code>&lt;h1&gt;{$sentence}&lt;/h1&gt;
  </code></pre>
  
  <p>Is it possible to do all this in the template instead? Since this isn't exactly programming logic but more a presentation logic, i would like it all in the template like so:</p>
  
  <pre><code>&lt;h1&gt;{'Hello you', 'Hi mate', 'Welcome'| selectRandom }&lt;/h1&gt;
  </code></pre>
  
  <p>Something like that?</p>