Skip to content

Commit b0dc3de

Browse files
committed
Qute: include - make it possible to supply the template id dynamically
- resolves #41050
1 parent 66aefab commit b0dc3de

File tree

4 files changed

+288
-133
lines changed

4 files changed

+288
-133
lines changed

docs/src/main/asciidoc/qute-reference.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,15 @@ This section can be used to include another template and possibly override some
11271127
<1> Include a template with id `foo`. The included template can reference data from the current context.
11281128
<2> It's also possible to define optional parameters that can be used in the included template.
11291129

1130+
By default, the first unnamed parameter represents the id of a template that should be included.
1131+
And it is taken as is.
1132+
For example, `{#include bar/foo /}` includes a template with id `bar/foo`; i.e. `src/main/resources/templates/bar/foo.html` could be matched.
1133+
However, it is also possible to supply the template id dynamically.
1134+
Just add the `_dynamic=true` or `_dynamic` argument to the tag.
1135+
In this case, the first unnamed parameter represents an expression that is resolved and the result represents the template id.
1136+
For example, `{#include bar.foo _dynamic /}` means that `bar.foo` is first resolved and then the resulting template id is used.
1137+
1138+
11301139
_Template inheritance_ makes it possible to reuse template layouts.
11311140

11321141
.Template "base"

0 commit comments

Comments
 (0)