It has been repeated several times in the template, can you simplify it?

                    <select name="class">
                        {foreach $res as $value}
                            <option>{$value["class"]}</option>
                        {/foreach}
                    </select>

the above code, in my template file, different places, repeated 3 times (exactly the same), excuse me, can it be simplified?

Jan.28,2022
The

backend directly writes an output of select DOM to the variable, and the view output variable is fine.

Menu