title: Reproduce a option group of 3 levels with smarty
body: <p>In a recent project I have found that they're using smarty and the client needs a option group of 3 levels. I've never used smarty and I find this particular case a little hard to do it from scratch.</p>
  
  <p>I need to do the next but with smarty:</p>
  
  <pre><code>&lt;select&gt;
      &lt;optgroup label="Level One"&gt;&lt;/optgroup&gt;
          &lt;optgroup label="Level Two" style="padding-left:15px"&gt;&lt;/optgroup&gt;
              &lt;option style="padding-left:30px"&gt; A.B.1 &lt;/option&gt;    
          &lt;optgroup label="Level Two" style="padding-left:15px"&gt;&lt;/optgroup&gt;
              &lt;option style="padding-left:30px"&gt; A.B.2 &lt;/option&gt;
      &lt;optgroup label="Level One"&gt;&lt;/optgroup&gt;
          &lt;optgroup label="Level Two" style="padding-left:15px"&gt;&lt;/optgroup&gt;
              &lt;option style="padding-left:30px"&gt; A.B.1 &lt;/option&gt;    
          &lt;optgroup label="Level Two" style="padding-left:15px"&gt;&lt;/optgroup&gt;
          &lt;option style="padding-left:30px"&gt; A.B.2 &lt;/option&gt;    
  &lt;/select&gt;
  </code></pre>
  
  <p>I would also want to know what is the best way to inform this smarty; with an array of 3 levels or how (I'm using PHP) and if I have a default option how I've to indicate it.</p>
  
  <p>Thank you in advance!</p>
  
  <p><strong>Update:</strong> code actually using</p>
  
  <pre><code>$arr['Sport'] = array(6 =&gt; 'Golf', 9 =&gt; 'Cricket',7 =&gt; 'Swim');
  $arr['Rest']  = array(3 =&gt; 'Sauna',1 =&gt; 'Massage', "Test" =&gt; array(10 =&gt; 'Other', 11 =&gt; 'Option'));
  
  $smarty-&gt;assign('lookups', $arr);
  $smarty-&gt;assign('fav', 7);
  </code></pre>
  
  <p>This actually is giving me only 2 levels.</p>
  
  <p><strong>Update 2</strong></p>
  
  <p><img src="https://i.stack.imgur.com/m5Bcc.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/ktSE8.png" alt="enter image description here"></p>