Open thewebartisan7 opened 4 years ago
I check a bit inside code and I understand now why not works compiling page that extend layout.
this code:
$blade = preg_replace("/@section(?s).*?stop/si", "{{-- section was here --}}", $blade);
Doesn't work when @section
is closed using @endsection
, but must be @stop
Now remain only issue with compiling layouts.
Let me know if there is a way, I will continue to check in code maybe I understand.
Thanks
I find a workaround for compile also layouts by keeping yields(). It was easy, but not sure if this can make some issue. I tested and seem works fine. But maybe I am introducing some issue. Please let me know what do you think.
private function implodeLayout(&$blade)
{
$sections = $this->seperateSections($blade);//B1 @done
$this->replaceLayout($blade);//B2 @done
// Just commented this:
//$this->replaceSections($blade, $sections);//B3 @inprogress
}
If this works, could be add a new options for keep yield so that works also in this case.
What do you think?
I also see what it's used the extract() method, to extract variable passed to partials view.
I have tested this package for compile my layout file which include too much things.
However the result was not as expected.
But commenting method
implodeLayout()
worked fine, this:Without this the main yield('content') is replaced by:
{{--yield didnt have alternative--}}
Is not designed for works also with layouts?
If I try to compile a view that extends a layout, also not works, this is the result (most part are removed):
As you can see yield('content') is removed and the view compiled is on top and not inside content.
Maybe this works only with partials views?
Then I wonder why is added this php code for each included file:
<?php extract([]); ?>
Thanks