title: value of a calculated index in smarty array
body: <p>Is there some way to calculate index inside the array brackets? I'll explain what i mean</p>
  
  <p>I created an array in Smarty by exploding a string that i got from php. Now i want to get the value at the last index. So i tried this</p>
  
  <pre><code>{assign var='array' value=','|explode:$no}     //$no is the comma separated string
  &lt;h1&gt;{$array[$array|@count]}&lt;/h1&gt;               //this should be a blank value because i am going past the last index
  </code></pre>
  
  <p>this gave me error
  <code>Fatal error: Smarty error: [in categories.tpl line 8]: syntax error: unrecognized tag: $array[$array|@count]</code>    </p>
  
  <p>then i tried </p>
  
  <pre><code>{assign var='array' value=','|explode:$no}     //$no is the comma separated string
  {assign var='c' value=$array|@count}
  &lt;h1&gt;{$array[$c-1]}&lt;/h1&gt;                        //$c is the count    
  </code></pre>
  
  <p>this gave yhe following error
  <code>Fatal error: Smarty error: [in categories.tpl line 8]: syntax error: unrecognized tag: $array[$c-1]</code></p>
  
  <p>Finally the code which worked was this</p>
  
  <pre><code>{assign var='array' value=','|explode:$no}
  {assign var='c' value=$array|@count}
  {assign var='c1' value=$c-1}
  &lt;h1&gt;{$array[$c1]}&lt;/h1&gt;
  </code></pre>
  
  <p>Now this is stupid because i have to first calculate the index and store in it a variable to use it. Cant i use an "<strong>on the fly generated index</strong>"?
  Thanks.</p>