Php Blade syntax@extends加载第二个HTML视图,然后加载第一个HTML视图

Php Blade syntax@extends加载第二个HTML视图,然后加载第一个HTML视图,php,blade,laravel-5.3,laravel-blade,Php,Blade,Laravel 5.3,Laravel Blade,我是新的拉威尔和叶片模板引擎。 问题:form.blade.php文件 @扩展('front.header') @扩展('front.footer') 首先加载front/footer.blade.php,然后加载front/header.blade.php的内容 请查找附加的视图源快照 我查了他们关于空白的一些答案。我似乎没有任何答案 问候,, Jignesh您不能从两个父级扩展。如果要包含另一个视图,应使用@include 像这样: @include('front.header') Cont

我是新的拉威尔和叶片模板引擎。 问题:form.blade.php文件

@扩展('front.header') @扩展('front.footer')

首先加载front/footer.blade.php,然后加载front/header.blade.php的内容

请查找附加的视图源快照

我查了他们关于空白的一些答案。我似乎没有任何答案

问候,,
Jignesh

您不能从两个父级扩展。如果要包含另一个视图,应使用
@include

像这样:

@include('front.header')
Content
@include('front.footer')

这就是我建议构建主模板的方式

前。_layouts.master:

@包括('front.\u layouts.head')
@包括('front.\u layouts.header')
@产量(‘含量’)
@包括('front.\u layouts.header')
@堆栈('脚本')
请注意
@stack()
这在创建应用程序的健壮部分时非常有用允许您推送到彼此顶部的命名堆栈。

按照以下步骤操作:

步骤1:

参考资料\视图创建一个文件,如:master.blade.php

步骤2:

资源\视图创建一个文件夹,如:layouts

布局
文件夹内创建
页眉
页脚
文件

步骤3:

master.blade.php
中,写下如何像这样设计主模板

<!DOCTYPE html>
<html lang="en">
    <head>
        <!-- your common css here -->

        @yield('partial-css')

    </head>

    <body>
        @include('layouts.top-header')             

        <div class="container">
            @yield('content') <!-- this is your common body -->
        </div> <!-- /container --> 

        @include('layouts.footer')

        <!-- your common js here or you also define inside the footer page -->

        @yield('script') <!-- this is your individual script for all page -->

    </body>
</html>

希望您现在了解刀片模板的工作原理

不能从两个父级扩展。如果你想包含另一个视图,你应该使用
@include('front.header')
@include('front.footer')
我发布了一个答案供将来参考
<!DOCTYPE html>
<html lang="en">
    <head>
        <!-- your common css here -->

        @yield('partial-css')

    </head>

    <body>
        @include('layouts.top-header')             

        <div class="container">
            @yield('content') <!-- this is your common body -->
        </div> <!-- /container --> 

        @include('layouts.footer')

        <!-- your common js here or you also define inside the footer page -->

        @yield('script') <!-- this is your individual script for all page -->

    </body>
</html>
@extends('master')

@section('content')

<!-- Here is your main body content -->

@endsection

@section('script')

<!-- Here is your individual script content -->

@endsection