我试图在整个网站中使用弹出窗口。我注意到,如果在一个页面上多次扩展一个模板,结果将由最后一个模板重写。任何帮助吗?
<!-- layout.blade.php -->
@yield('section1')
div div div
@yield('section2')
<!-- popup1.blade.php -->
@extends('layout')
@section('section1')
<p>here's some content about cats</p>
@stop
@section2('section2')
<p>bla bla bla </p>
@stop
<!-- popup2.blade.php -->
@extends('layout')
@section('section1')
<p>here's some content about monkeys</p>
@stop
@section('section2')
<p> bla bla bla </p>
@stop
好吧,我自己找到了一个解决方案。以防有人遇到同样的问题。以下是解决方案
用@overwrite结束每个section,问题就解决了。
<!-- layout.blade.php -->
@yield('section1')
div div div
@yield('section2')
<!-- popup1.blade.php -->
@extends('layout')
@section('section1')
<p>here's some content about cats</p>
@overwrite
@section2('section2')
<p>bla bla bla </p>
@overwrite
<!-- popup2.blade.php -->
@extends('layout')
@section('section1')
<p>here's some content about monkeys</p>
@overwrite
@section('section2')
<p> bla bla bla </p>
@overwrite