In my particular case I need to be able to switch the layout that the template extends. Is this possible to do using locales?
Asked
Active
Viewed 296 times
1 Answers
7
Untested, but should be fairly straightforward.
{% if craft.locale == 'de' %}
{% set template = '_layout_de.html' %}
{% else %}
{% set template = '_layout.html' %}
{% endif %}
{% extends template %}
or
{% extends craft.locale == 'de' ? '_layout_de.html' : '_layout.html' %}
or using a locale folder (thank josh baker)
{% extends craft.locale ~ '/_layout' %}
Douglas McDonald
- 13,457
- 24
- 57
{% extends craft.locale ~ '/_layout' %}would point to/templates/en/_layout. – Joshua Baker Jul 22 '15 at 17:40extendsbefore the conditional construct? – Ian Young Jul 27 '15 at 11:14{% extends "layouts/" ~ craft.locale ~ '/layout-name' %}. Many thanks for the help and suggestions. – Ian Young Jul 28 '15 at 15:37