Improve backward compatibility of the template

Avoid nesting <% %> tags inside <%-- --%> comments. It breaks at least
SilverStripe 3.0.5.
Merge branch 'dev'