geo*_*310 5 php laravel blade laravel-5
我想从视图中写入模板中的一个区域,也从包含的视图中写入第一个视图,但无论我尝试什么,它都不起作用。我试过使用@parent 和@append,但到目前为止没有产生我想要的结果。
在我的布局中,我有以下内容:
@yield('scripts')
Run Code Online (Sandbox Code Playgroud)
在我看来,primary 我有以下几点:
@include('admin/rules/partials/_form')
@section('scripts)
// javascript #1 here
@stop
Run Code Online (Sandbox Code Playgroud)
在 admin/rules/partials/_form 我有以下内容:
@section('scripts)
// javascript #2 here
@stop
Run Code Online (Sandbox Code Playgroud)
所以就像我说的,我已经尝试在 @section('scripts') 之后使用 @parent 并且还使用 @append 而不是 @stop 但我所做的一切都没有正确地包含两个脚本块。到目前为止,我所拥有的最好的是 javascript #1 被包含一次,javascript #2 被包含两次。我将如何做到这一点,以便每个代码块仅附加到脚本区域一次?
我最终解决了它,我必须执行以下操作:
@yield('scripts')
Run Code Online (Sandbox Code Playgroud)
在我看来,primary 我有以下几点:
@include('admin/rules/partials/_form')
@section('scripts)
// javascript #1 here
@stop
Run Code Online (Sandbox Code Playgroud)
在 admin/rules/partials/_form 我有以下内容:
@section('scripts)
@parent
// javascript #2 here
@overwrite
Run Code Online (Sandbox Code Playgroud)