vendredi 30 septembre 2016

Laravel 5 - Compile String and Interpolate Using Blade API on Server

Using the Blade service container I want to take a string with markers in it and compile it down so it can be added to the blade template, and further interpolated.

So I have an email string (abridge for brevity) on the server retrieved from the database of:

<p>Welcome ,</p>

And I want it to interpolated to

<p>Welcome Joe,</p> 

So I can send it to a Blade template as $content and have it render all the content and markup since Blade doesn't interpolate twice and right now our templates are client made and stored in the database.

Blade::compileString(value) produces <p>Welcome <?php echo e($first_name); ?>,</p>, but I can't figure out how to get $first_name to resolve to Joe in the string using the Blade API, and it doesn't do it within the Blade template later. It just displays it in the email as a string with PHP delimiters like:

<p>Welcome <?php echo e($first_name); ?>,</p>

Any suggestions?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire