We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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 {{ }} ?



3.4k
Accepted
answer

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