Smarty is used to render a select and handle the localization:
<select name="divisions">
{section name=i loop=$divisions}
{assign var='name' value=$divisions[i].name}
{assign var='code' value=$divisions[i].code}
<option value="{$code}" {if $user.division == $code}selected=yes{/if}>
{eval var=$name}
</option>
{/section}
</select>
The problem is, that although the code is always the same, the name is different in the various languages and the select should be sorted by the later.
But I can't figure out a solution, since I would need to combine {eval var=$name}
with assign
in which case I could implement the following`:
- First section: replace code with the value from
{eval}
- Sort the array via
{php}
based on$divisions[i].name
- Second section: output
I have a client based solution, but it's more a workaround then anything I'd like to use.