user3386779
user3386779

Reputation: 7215

create layout for template in laravel 5.3

I want to create template for my project.In my projects I'm using header and css and js and footer for all page.(i.e page1.blade.php,page2.blade.php,etc).while loading each page it takes more time to load.so I need to create a common layout and load the content(i.e page1.blade.php,page2.blade.php,etc) in content section.

How to create master layout and load the page1.blade.php and page2.blade.php and so on.I want to create link this

<html>
<head>
    <title>Title</title>
</head>
<body>
    @section('sidebar')
        This is the master sidebar.
    @show

    <div class="container">
        @yield('content')
    </div>
</body>

Upvotes: 0

Views: 1408

Answers (3)

abhayendra
abhayendra

Reputation: 187

@extends('layouts.app')

@section('content')

<h2>Your Content </h2>

@endsection

Upvotes: 1

Henrik
Henrik

Reputation: 189

This is what your page1.blade.php could look like:

@extends('layouts.includes.default')

@section('content')

// Your content

@stop

You can read about Blade templates in the Laravel documentation: https://laravel.com/docs/5.2/blade

Upvotes: 2

rupesh
rupesh

Reputation: 277

IN your resouce foloder create sub folder by the name layout and there u create a file master.blade.php Ex: resource->layout->master.blade.php

Now in your page.blade.php just extend it using @extends('layout.master')

Upvotes: 1

Related Questions