title: alternative way to use if statement inside a select tag in smarty
body: <p>I have been using smarty template engine for a while and now I'm facing this situation.</p>
  
  <p>Why is this giving me an error?</p>
  
  <pre><code>&lt;select  class="m-wrap span8" name="status" required&gt;
    &lt;option value="" {if $frontuser-&gt;status eq ''}selected{/if}&gt;Seleccione&lt;/option&gt;
    &lt;option value="1" {if $frontuser-&gt;status eq '1'}selected{/if}&gt;No Activo&lt;/option&gt;
    &lt;option value="2" {if $frontuser-&gt;status eq '2'}selected{/if}&gt;Activo&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>As you can see I'm calling status attribute from object "frontuser" and what I want to do is to read from the database if status is 1, 2 or empty. So if it's one of those options, the select tag has to show it.</p>
  
  <p>I have tried this before and worked but not with an object, but with an array, as you can see here:</p>
  
  <pre><code>&lt;select  class="m-wrap span8 chosen" name="gender" data-with-diselect="1" required&gt;
    &lt;option value=" " {if $okInfo['gender'] eq ' '}selected{/if}&gt;Seleccione&lt;/option&gt;
    &lt;option value="1" {if $okInfo['gender'] eq '1'}selected{/if}&gt;Hombre&lt;/option&gt;
    &lt;option value="2" {if $okInfo['gender'] eq '2'}selected{/if}&gt;Mujer&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Any clues? thanks!</p>