Fork me on GitHub
#luminus
<
2018-03-20
>
jumar14:03:20

I'm trying to include template while passing parameters like this:

{% include "posts/edit-post-fragment.html" with form-action-url="/posts/{{post/id}}" submit-button-text="Update" %}
However, I'm getting this error
Error parsing the tag: malformed tag arguments in include "posts/edit-post-fragment.html" with form-action-url="/posts/{{post/id on line 14 for template file:...../posts/post-edit.html
If I use hardcoded value instead of {{post/id}} the template is rendered properly.

jumar14:03:14

Of course, that syntax {{post/id}} works properly when used in the parent template directly.

yogthos15:03:12

yeah that's happening because includes are resolved when the templates are compiled, and that happens before the context map is available

jumar17:03:36

so there's no option how to do that?

yogthos17:03:12

you can use a with inside the include https://github.com/yogthos/Selmer#with