Showing posts with label How to define the layout of laravel. Show all posts
Showing posts with label How to define the layout of laravel. Show all posts

Monday, 21 September 2015

Best Php Framework Laravel: How to define the layout of laravel

The two way of defining the blade are template inheritance and section. Both are good to use. I like the section uses. I am just giving some example for that. It is basically good to know the uses for that. Almost all page of web application used the same layout . that is called innner layout and home layout. It is better to define those kind of layout at your web apps. giving you the single blade view.

<!-- Stored in resources/views/layouts/innermaster.blade.php -->

<html>
    <head>
        <title>App Name - @yield('title')</title>
    </head>
    <body>
        @section('sidebar')
            This is the master sidebar.
        @show

        <div class="container">
            @yield('content')
        </div>
    </body>
</html>
As you can see on the above example there is HTML mark  up. However, remember the @section and @yield directives, @section is for section of  content and @yield directives is for contents of given section