刀片模板视图

I need a fresh pair of eyes understanding how I can understand this problem I have. I am new so please be kind to me to the blade templating method. So I am trying to achieve something which seems to be relatively straight forward but scratching my head in trying to understand it.

So my directory will drill down like this: index -> view posts -> create posts so the URL will reflect this (mysite.com/posts/createPost)

I have a screenshot to show my file structure, please see attached: ![enter image description here][1]

I am trying to understand how to lay the page out even after following the blade templating documentation, I appear to have come to a brick wall.

My main index page looks like this:

@include('layouts.includes.header')
    <div class="col-group-sm">
        Left hand sidebar

    </div>
    <div class="col-group-lg">

        Right hand sidebar

    </div>
@include('layouts.includes.footer')

within the 'includes' file I have a file called 'index.blade.php' which looks like this:

@extends('layouts.index')

<div class="row">

@section('leftContent')
    @yield('leftContent')   
@stop


@section('rightContent')
    @yield('rightContent')  
@stop
</div>

This all appears to be working great. However within this posts directory is where I am stuck. So I have a file called viewPost.blade.php

@include('layouts.partials.header')
    @yield('leftContent')
    @yield('rightContent')  
@include('layouts.partials.footer')

I am just really confused now of how to structure my files, I feel I am almost there but not!

In the parent template you use the @yield('tag') in order to inject the content of a @section('tag') in the child.

Try the following:

<!-- index.blade.php -->
@include('layouts.includes.header')
@yield('page')
@include('layouts.includes.footer')

-

<!-- content.blade.php -->
@extends('index')
@section('page')
    <div class='col-group-sm'>
        @yield('sidebar')
    </div>
    <div class='col-group-lg'>
        @yield('content')
    </div>
@stop

-

<!-- anyotherpage.blade.php -->
@extends('content')
@section('sidebar')
    <!-- My sidebar content -->
@stop
@section('content')
    <!-- My main content -->
@stop

See if that works.