michouël
michouël

Reputation: 35

How to break line between 2 variables

I'm trying to have something like this:

Rue Félicité Beaudin
13004 Marseille

And in twig I've got 3 variables :

I've tried to do :

{{ company.address~"\n"~company.zipcode|raw|nl2br }} {{ company.city }}

but no success, is there a way to break the line between 2 variables ?

Upvotes: 0

Views: 102

Answers (1)

DarkBee
DarkBee

Reputation: 15572

Your filters willy only apply the closest variable met, meaning the filters will only be applied to company.zipcode.

You need to add parentheses to span across multiple elements,

{{ (company.address~"\n"~company.zipcode)|raw|nl2br }}

demo

Upvotes: 1

Related Questions