我可以扩展已经为 Laravel 5 扩展了 blade.php 的 blade.php 吗?
Can I extend a blade.php that already extends a blade.php for Laravel 5?
如标题所述,当我尝试扩展一个已经扩展了另一个 layout/view 的 layout/view 时,出现错误 "View cannot be found"。我可能会混淆布局和视图。我可以做我想做的事吗?
您对文件夹结构非常小心,例如:
/-----views/layouts/base.blade.php-----/
<h1>Hey there</h1>
@yield('section1)
那么你的第一个 child 应该是:
/-----views/childs/child1.blade.php-----/
@extends('layouts.base')
@section('section1')
<p>this is section 1 on child</p>
@stop
@yield('section2')
之后,盛大child:
/-----views/grandchilds/grandchild1.blade.php-----/
@extends('childs.child1')
@section('section2')
<p>this is section 2 on granchild</p>
@stop
最后你可以像这样在控制器中调用 grand child:
/----- ../MyController.php ----/
...
return view('grandchilds.grandchild1');
...
如标题所述,当我尝试扩展一个已经扩展了另一个 layout/view 的 layout/view 时,出现错误 "View cannot be found"。我可能会混淆布局和视图。我可以做我想做的事吗?
您对文件夹结构非常小心,例如:
/-----views/layouts/base.blade.php-----/
<h1>Hey there</h1>
@yield('section1)
那么你的第一个 child 应该是:
/-----views/childs/child1.blade.php-----/
@extends('layouts.base')
@section('section1')
<p>this is section 1 on child</p>
@stop
@yield('section2')
之后,盛大child:
/-----views/grandchilds/grandchild1.blade.php-----/
@extends('childs.child1')
@section('section2')
<p>this is section 2 on granchild</p>
@stop
最后你可以像这样在控制器中调用 grand child:
/----- ../MyController.php ----/
...
return view('grandchilds.grandchild1');
...