Jhonne
Jhonne

Reputation: 424

Twig set a value from a string and variable

{% set url = '/f/' . topic.name . '/' %}

I have some problems getting this to work. Anyone knows how to do this correctly?

Upvotes: 16

Views: 16820

Answers (1)

Thomas K
Thomas K

Reputation: 6196

Concatenation is done with a ~:

{% set url = '/f/' ~ topic.name ~ '/' %}

Upvotes: 31

Related Questions