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.
I need to do the next but with smarty:
<select>
<optgroup label="Level One"></optgroup>
<optgroup label="Level Two" style="padding-left:15px"></optgroup>
<option style="padding-left:30px"> A.B.1 </option>
<optgroup label="Level Two" style="padding-left:15px"></optgroup>
<option style="padding-left:30px"> A.B.2 </option>
<optgroup label="Level One"></optgroup>
<optgroup label="Level Two" style="padding-left:15px"></optgroup>
<option style="padding-left:30px"> A.B.1 </option>
<optgroup label="Level Two" style="padding-left:15px"></optgroup>
<option style="padding-left:30px"> A.B.2 </option>
</select>
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.
Thank you in advance!
Update: code actually using
$arr['Sport'] = array(6 => 'Golf', 9 => 'Cricket',7 => 'Swim');
$arr['Rest'] = array(3 => 'Sauna',1 => 'Massage', "Test" => array(10 => 'Other', 11 => 'Option'));
$smarty->assign('lookups', $arr);
$smarty->assign('fav', 7);
This actually is giving me only 2 levels.
Update 2


Have a look at {html_options}.
edit
Smarty3 Template
generates the following HTML (manually indented)
Which loooks pretty much like one would expect. But viewing this in Firefox 7, I see the properly nested groups being displayed on the same level: