Reputation: 41
I am trying to use popups throughout my site. What I've noticed is that if you extend a template more than once on a page, the yields end up being rewritten by the last one. Any help?
<!-- 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
Upvotes: 2
Views: 811
Reputation: 41
Well, I found a solution for the same by myself. In case anyone run into the same problem. Here is the solution
End each section with @overwrite and it will solves the problem.
<!-- 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
Upvotes: 2