I'm working on a small CRM system where users need the option to send emails to other users and to load predefined templates. Currently the templates are stored in my views/emails/templates folder. Example: new_order.blade.php
Inside the template I have the following code syntax:
Visit us at: {{{ (isset($isTemplate) && $isTemplate) ? '{{ $offerUrl }}' : $offerUrl }}}
This kind of works but parses the string that need to be outputed exactly like that to real php code.
Visit us at: <?php echo $offerUrl ?>
Is there any solution to echo blade tags?
Actually Laravel supports {{}} and {{{}}} to escape data.
In Laravel, @yield is principally used to define a section in a layout and is constantly used to get content from a child page unto a master page.
The Blade is a powerful templating engine in a Laravel framework. The blade allows to use the templating engine easily, and it makes the syntax writing very simple. The blade templating engine provides its own structure such as conditional statements and loops.
You can use the @{{
to escape a blade syntax. So you could use
'@{{ $offerUrl }}'
That @{{ $offerUrl }} syntax works only if both(open and close) curly bracket pairs exist. Otherwise if string contains any curly bracket I suggest to use plane old php syntax like
<?php echo '$offerUrl }}'?>
and you will have nothing weird to ecape.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With