Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Set variable with a concatenation

Hi everyone

I try to performe the following instruction :

{% set editUrl = url(controller ~ '/edit/') %} (controller is a variable passed from parent)

but it renders the error :

Scanning error before '�'/edit/' %} {#...'app/views/navBar.twig on line 1

Likewise without url().

{% set editUrl = controller ~ '/edit/') %}

No error if I remove this line, so does ~ operator only works in {{ }} ?


{% set editUrl = url(controller ~ '/edit/') %} now works. I don't know what happened XD