Setting the Escaped Content Tags Blade Uses

Problem

You want to use different escaped content tags in your Blade template.

You know that blade uses {{{ and }}} to specify content to be escaped and output, but you want to use something different.

Solution

Use the Blade::setEscapedContentTags() method.

Let's say you want to use [{{ and }}] for your tags. First call the method.

Blade::setContentTags('[{{', '}}]');

Then your template can contain code like.

The value of $variable is [{{ $variable }}].

$variable will pass through HTML::entities() before being output.

Discussion

This actually calls Blade::setContentTags().

It passes the third argument as true. See Setting the Content Tags Blade Uses.

comments powered by Disqus