Blade engine: printing 3D curly braces

I know how to print double curly braces in Laravel: @{{ }} .

But how can I print triple braces? My first thought about adding @ didn't work before, Laravel was still trying to interpret it.

Is there an easy way without encoding braces for HTML objects?

+6
source share
4 answers

This is the easiest way. Use HTML objects to avoid curly braces. Tested in Laravel 5. See here for a list of HTML objects. HTML objects

code

 {{ '{{{' . 'text'. '}}}' }} 

Output

 {{{text}}} 
+6
source

Update

More recently, a request has been compiled that fixes this problem !!
With Laravel 5.1.7, you can use the @ sign, as expected:

 @{{{ ... }}} 

Original answer

The least ugly workaround I've found so far is to avoid the first two brackets as normal and add invisible between them and the third bracket:

 @{{‌{test}}} 

I will investigate further and update this answer if I find something better ...

+7
source

Use this if you just want to print them:

 {{ '{{{' }} 
+1
source

I ran into the same problem while trying to render some raw HTML using Vue.js in laravel 4.2. For me, the simplest solution was to simply use a simple php echo expression in the blade server template:

 <?php echo '{{{ text }}}'; ?> 

Did the trick for me.

+1
source

Source: https://habr.com/ru/post/985100/


All Articles