craft3-templateselect
craft3-templateselect copied to clipboard
FR: Template subfolder variable
Could you please add the option to output the selected template's full path or subfolder so in a front end template this doesn't have to be hardcoded?
so instead of {% include '_mysubfolder/' ~ entry.template %}
maybe {% set template = entry.template %}
then {% include template.filepath %}
or {% include template.subfolder ~ template %}
Big upvote for this.
Another option would to allow the subfolder to be set via a .env variable.
Application Info PHP version | 8.0.8 MySQL 8.0.27 Craft Pro 3.7.31 Yii version 2.0.44 Twig version v2.14.11 Template Select 2.0.2
This is now available with v5.0.0.
These are the different options now:
Output the chosen template name:
{{ entry.fieldHandle }}
Include/Embed the chosen template:
{% include entry.fieldHandle %}
Include the template including subfolder if set:
{% include entry.fieldHandle.withSubfolder() %}
This is a alias for the following:
{{ entry.templateWithSubfolder.template(true) }}
Output the subfolder name:
{{ entry.fieldHandle.subfolder() }}
Output the filename without path:
{{ entry.fieldHandle.filename() }}