I am looking to Bootstrap my site and as such, have put common twitter bootstrap components into blade templates.
sidebar.blade.php
@include('panel1')
@include('panel2')
panelTemplate.blade.php
<div class="panel panel-primary">
<div class="panel-heading">
<div class="panel-title">
@yield('title')
</div>
</div>
<div class="panel-body">
@yield('body')
</div>
<div class="panel-footer">
@yield('footer')
</div>
</div>
This way, every time I wish to use a panel, then I can use @extends('panelTemplate')
.
panel1.blade.php
@extends('panelTemplate')
@section('title')
title panel 1
@stop
@section('body')
body panel 1
@stop
@section('footer')
footer panel 1
@stop
panel2.blade.php
@extends('panelTemplate')
@section('title')
title panel 2
@stop
@section('body')
body panel 2
@stop
@section('footer')
footer panel 2
@stop
The problem that I am facing is that instead of showing the contents of panel1.blade.php
, then the contents of panel2.blade.php
as declared in sidebar.blade.php
the contents of panel1.blade.php
is being repeated (shown twice).
Is Blade caching the request which is why panel1 is being repeated twice? Is there a way to override this behaviour or am I using the blade templating engine in a way which it was never intended?