10
votes

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?

2

2 Answers

13
votes

You can use the @{{ to escape a blade syntax. So you could use

'@{{ $offerUrl }}'
0
votes

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.