I have these three blade templates
In my controller I'm calling dashboard view like this:
View::make('layouts.dashboard');
master.blade.php
<?= stylesheet_link_tag() ?>
<?= javascript_include_tag() ?>
<html>
<body class="fixed">
<div class="wrapper">
<div class="leftside">
@yield('leftside', 'left-side content')
</div>
<div class="rightside">
@yield('rightside', 'right-side content')
</div>
</div>
</body>
dashboard.blade.php
@extends('layouts.master')
@section('leftside')
@yield('sidebar', 'sidebar content')
@stop
sidebar.blade.php
@extends('layouts.dashboard')
@section('sidebar')
aaa
@stop
The dasbhoard blade shows properly in master blade, but sidebar blade doesn't want to show. Does anyone know what i'm doing wrong?
Thank your very much for any help :)
I don't think you can use yield() on a blade template that is not called.
Basically what you can do is make your master.blade.php into this
<html>
<body class="fixed">
<div class="wrapper">
<div class="leftside">
@include('sidebar') {{-- This is sidebar.blade.php --}}
</div>
<div class="rightside">
@include('dashboard') {{-- This is dashboard.blade.php --}}
</div>
</div>
</body>
</html>
Then, assuming that your are calling the dashboard.blade.php template, with both blade templates included. You can use the sections on either master.blade, or sidebar.blade inside dashboard.blade
@extends('layouts.master')
{{-- You can define now the sections available on master.blade and dashbard.blade --}}
OK I found out what was wrong :)
I called View::make('layouts.dashboard') instead of View::make('layouts.sidebar');