Closed dib258 closed 2 years ago
Did you try it like this (Heredoc
instead of Nowdoc
)?
use function Termwind\render;
$test = 'hello';
render(<<<HTML # <-- note the missing single quotes!
<div>
<div class="px-1 bg-green-600">test : </div>
<div class="ml-1">
{$test}<br>
$test<br>
${test}<br>
{{ $test }}<br>
<?php $test; <br>
</div>
</div>
HTML);
Oh my god thank you, what a sneaky nowdoc !
test
hello
hello
hello
{{ hello }}
Thank you for that fast answer, I should have searched more on that nowdoc notation.
Hi,
I was recently trying to use Termwind with Laravel Zero to make a small cli/php app.
After trying to print the first layout with Termwind, I can't get my head around the possibility to inject a variable in the template before rendering it.
Either I miss something, either I'm in a specific case (Laravel Zero, which has striped a lot of functionality of Laravel).
With this as an output :
resources/views
and the filetermwind.blade.php
with the template with the previous template. I found out that the view helper is present but there was noViewServiceProvider
.This was a good try but Laravel Zero just have a subset of
laravel/framework
. Just theFoundation
folder not theView
one. I could try to pull the wholelaravel/framework
but I think it's not the way to go. Here was the code I wanted to try :I get the following error :
I am actually now out of idea to try this. Any help appreciated! I'm using :
Thanks for reading me and I'm hoping this can help others that want to use this wonderful tool you created !