Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twig - Do not interpret

Tags:

twig

I'm looking for a tag which would enable me to stop interpreting in a section, in a template.

So I'm looking for something that is similar to smarty's literal tag.

Thanks

like image 323
Davis Avatar asked Jun 23 '11 10:06

Davis


People also ask

What is the difference between {{ }} and {% %} in twig?

There are two kinds of delimiters: {% ... %} and {{ ... }} . The first one is used to execute statements such as for-loops, the latter outputs the result of an expression.

How do you write a twig?

To start writing Twig code in your HTML, there are only two different syntaxes: {{ }} The "say something" syntax. {% %} The "do something" syntax.


2 Answers

I think you're looking for {% verbatim %} / {% endverbatim %}. In earlier versions these were called {% raw %} / {% endraw %}.

See also Twig Escaping.

like image 87
Shad Avatar answered Oct 04 '22 22:10

Shad


In Twig, it is now verbatim, see http://twig.sensiolabs.org/doc/tags/verbatim.html

like image 36
Harry Oosterveen Avatar answered Oct 04 '22 21:10

Harry Oosterveen