Laravel - Load common header and footer to view Laravel - Load common header and footer to view laravel laravel

Laravel - Load common header and footer to view


To include blade template into another template, use @include:

@include('admin.dashboard')

Or

@include($data['template']) // This should be the name of template, like 'admin.dashboard', but not path

Also, check if view has correct name and is in right directory:

resources/views/admin/dashboard.blade.php


First of all your code require correction as per the laravel blade code standard. Try below code:
common_template.blade View

@include('includes.header')@yield('content')@include('includes.footer')

dashboard.blade view

@extends('common_template')@section('content')    {{$data['title']}}@endsection


To include blade template into another template,

layouts/index.blade.php

<head>    <!-- Site Title -->    <title>{{ $title }}</title> //dynamic title    <link rel="stylesheet" href="{{ asset('website/css/main.css') }}"> @stack('css') //internal css</head><body>    @include('../website/layouts/header')//include header    @yield('content')//include content    @include('../website/layouts/footer') //include footer    <!-- start footer Area -->    <!-- End footer Area -->    <script src="{{asset('website/js/vendor/jquery-2.2.4.min.js ') }}"></script>    @stack('js')//internal js</body></html>

layouts/footer.blade.php

// footer code<h1>This area for footer code

layouts/header.blade.php

// headercode<h1>This area for headercode

/home.blade.php

<?php $title = "dynamic title"; ?> //title@extends('layouts/index') //include index page@Push('css') // this is for internal js*{color:black;}@endpush@section('content') //section for contentThis area for home page content@stop // content ended@Push('js') // this is for internal js<script>    $(document).ready(function(){         var loggedIn={!! json_encode(Auth::check()) !!};        $('.send').click(function() {            if(!loggedIn){                moda.style.display = "block";               return false;            }        });    });@endpush