lundi 7 mars 2016

Inheritance with Laravel 5

I have a master_page.blade with global content for my html:

<!DOCTYPE html>
<html lang="es">
<head>
    @include('layout.head')
</head>
<body>
    @include('layout.header')


    @yield('master_content')

    @section('footer')
        @include('layout.footer')
    @show

    @include('layout.scripts')

    @yield('custom_scripts')

</body>
</html>

After, I have a layout in Bootstrap with 2-6 columns, this blade inherit of the master_blade, his name is 2_10_columns.blade:

@extends('layout.master_page')

@section('master_content')
<div class="container">
    <div class="main-content">
        <div class="col-sm-2">
            @section('content1')
            @show
        </div>

        <div class="col-sm-10">     
            @section('content2')
            @show

        </div>
    </div>
</div>
@stop

Ok, this looks good but, finally I need fill the 2_10_columns.blade with some content, for example I tried this with mi contact.blade.php:

@extends('layout.2_10_columns')

@section('content1')
    <p>Column 2 left content of my section...</p>
@stop

@section('content2')
    <p>Column 10 right content of my section ...</p>
    ...some forms here
@stop

Definitely this does not work...

How could I do this with Laravel? Look at this infographic: enter image description here



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire