sonam
sonam

Reputation: 3770

How to print single quotes in twig template?

I need to assign a variable which contains single quote.

In php I would do:

$hello='testing \' quotes ';

What is the twig equivalent code for printing quotes?

Upvotes: 1

Views: 8157

Answers (1)

ButterDog
ButterDog

Reputation: 5245

It's the same since twig templates are converted to php anyway

{{ 'some string \' with a single quote in it' }}
{% set value = 'the quote is here ->\'<-' %} {{ value }}

Upvotes: 3

Related Questions