Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/255.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 包括Laravel刀片视图';仅限s部分_Php_Laravel_View_Laravel Blade - Fatal编程技术网

Php 包括Laravel刀片视图';仅限s部分

Php 包括Laravel刀片视图';仅限s部分,php,laravel,view,laravel-blade,Php,Laravel,View,Laravel Blade,是否有办法仅包括Laravel刀片视图的截面 我有一个基本视图,通常在该视图中包含内容。有时我需要更多的自由,想要一个更简单的基础,所以我将$special标志设置为true。现在我有了一个观点,它可能既是一个“特殊”的观点,也是一个正常的观点。有没有干净利落的方法 base.blade.php <!DOCTYPE html> <html> <head> <title>@yield("title", "placeholder") - we

是否有办法仅包括Laravel刀片视图的截面


我有一个基本视图,通常在该视图中包含内容。有时我需要更多的自由,想要一个更简单的基础,所以我将
$special
标志设置为true。现在我有了一个观点,它可能既是一个“特殊”的观点,也是一个正常的观点。有没有干净利落的方法

base.blade.php

<!DOCTYPE html>
<html>
<head>
    <title>@yield("title", "placeholder") - website</title>
</head>
<body>
    @if (isset($special) && $special)
        @yield("content")
    @else
        <header>
            website
        </header>
        <main>
            @yield("content")
        </main>
        <footer>&copy; 2099</footer>
    @endif
</body>
</html>
@extends("base")

@section("title", "10 ways! You won't follow the last!")

@section("content")
So much content.
@endsection
@extends("base", ["special" => true])

@section("title", "Welcome")

@section("content")
<div id="start">
    Other stuff
</div>
<div id="wooo">
    <main>
        @include("article") ← does not work
    </main>
    <footer>&copy; 2099</footer>
</div>
@endsection
@extends("base")

@section("title", "10 ways! You won't follow the last!")

@section("content")
@include("common")
@endsection
@extends("base", ["special" => true])

@section("title", "Welcome")

@section("content")
<div id="start">
    Other stuff
</div>
<div id="wooo">
    <main>
        @include("common")
    </main>
    <footer>&copy; 2099</footer>
</div>
@endsection
So much content.
@extends('base')

@section('body-content')

    <header>
        website
    </header>
    <main>
        @yield("content")
    </main>
    <footer>&copy; 2099</footer>

@endsection
@extends('base')

@section('body-content')
    <main>
        @yield("content")
    </main>
@endsection
other.blade.php

<!DOCTYPE html>
<html>
<head>
    <title>@yield("title", "placeholder") - website</title>
</head>
<body>
    @if (isset($special) && $special)
        @yield("content")
    @else
        <header>
            website
        </header>
        <main>
            @yield("content")
        </main>
        <footer>&copy; 2099</footer>
    @endif
</body>
</html>
@extends("base")

@section("title", "10 ways! You won't follow the last!")

@section("content")
So much content.
@endsection
@extends("base", ["special" => true])

@section("title", "Welcome")

@section("content")
<div id="start">
    Other stuff
</div>
<div id="wooo">
    <main>
        @include("article") ← does not work
    </main>
    <footer>&copy; 2099</footer>
</div>
@endsection
@extends("base")

@section("title", "10 ways! You won't follow the last!")

@section("content")
@include("common")
@endsection
@extends("base", ["special" => true])

@section("title", "Welcome")

@section("content")
<div id="start">
    Other stuff
</div>
<div id="wooo">
    <main>
        @include("common")
    </main>
    <footer>&copy; 2099</footer>
</div>
@endsection
So much content.
@extends('base')

@section('body-content')

    <header>
        website
    </header>
    <main>
        @yield("content")
    </main>
    <footer>&copy; 2099</footer>

@endsection
@extends('base')

@section('body-content')
    <main>
        @yield("content")
    </main>
@endsection
@extends(“基本”、[“特殊”=>true])
@章节(“标题”、“欢迎”)
@第节(“内容”)
其他东西
@包括(“条款”)← 不起作用
&抄袭;2099
@端部

我最终制作了一个新的刀片文件,其中只包含该部分。然后,两个页面都包含该刀片模板

article.blade.php

<!DOCTYPE html>
<html>
<head>
    <title>@yield("title", "placeholder") - website</title>
</head>
<body>
    @if (isset($special) && $special)
        @yield("content")
    @else
        <header>
            website
        </header>
        <main>
            @yield("content")
        </main>
        <footer>&copy; 2099</footer>
    @endif
</body>
</html>
@extends("base")

@section("title", "10 ways! You won't follow the last!")

@section("content")
So much content.
@endsection
@extends("base", ["special" => true])

@section("title", "Welcome")

@section("content")
<div id="start">
    Other stuff
</div>
<div id="wooo">
    <main>
        @include("article") ← does not work
    </main>
    <footer>&copy; 2099</footer>
</div>
@endsection
@extends("base")

@section("title", "10 ways! You won't follow the last!")

@section("content")
@include("common")
@endsection
@extends("base", ["special" => true])

@section("title", "Welcome")

@section("content")
<div id="start">
    Other stuff
</div>
<div id="wooo">
    <main>
        @include("common")
    </main>
    <footer>&copy; 2099</footer>
</div>
@endsection
So much content.
@extends('base')

@section('body-content')

    <header>
        website
    </header>
    <main>
        @yield("content")
    </main>
    <footer>&copy; 2099</footer>

@endsection
@extends('base')

@section('body-content')
    <main>
        @yield("content")
    </main>
@endsection
other.blade.php

<!DOCTYPE html>
<html>
<head>
    <title>@yield("title", "placeholder") - website</title>
</head>
<body>
    @if (isset($special) && $special)
        @yield("content")
    @else
        <header>
            website
        </header>
        <main>
            @yield("content")
        </main>
        <footer>&copy; 2099</footer>
    @endif
</body>
</html>
@extends("base")

@section("title", "10 ways! You won't follow the last!")

@section("content")
So much content.
@endsection
@extends("base", ["special" => true])

@section("title", "Welcome")

@section("content")
<div id="start">
    Other stuff
</div>
<div id="wooo">
    <main>
        @include("article") ← does not work
    </main>
    <footer>&copy; 2099</footer>
</div>
@endsection
@extends("base")

@section("title", "10 ways! You won't follow the last!")

@section("content")
@include("common")
@endsection
@extends("base", ["special" => true])

@section("title", "Welcome")

@section("content")
<div id="start">
    Other stuff
</div>
<div id="wooo">
    <main>
        @include("common")
    </main>
    <footer>&copy; 2099</footer>
</div>
@endsection
So much content.
@extends('base')

@section('body-content')

    <header>
        website
    </header>
    <main>
        @yield("content")
    </main>
    <footer>&copy; 2099</footer>

@endsection
@extends('base')

@section('body-content')
    <main>
        @yield("content")
    </main>
@endsection
我通常这样做:

我创建了一个包含布局核心内容的
base.blade.php

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>

    @yield('body-content')

</body>
</html>
someOtherTemplate.blade.php

<!DOCTYPE html>
<html>
<head>
    <title>@yield("title", "placeholder") - website</title>
</head>
<body>
    @if (isset($special) && $special)
        @yield("content")
    @else
        <header>
            website
        </header>
        <main>
            @yield("content")
        </main>
        <footer>&copy; 2099</footer>
    @endif
</body>
</html>
@extends("base")

@section("title", "10 ways! You won't follow the last!")

@section("content")
So much content.
@endsection
@extends("base", ["special" => true])

@section("title", "Welcome")

@section("content")
<div id="start">
    Other stuff
</div>
<div id="wooo">
    <main>
        @include("article") ← does not work
    </main>
    <footer>&copy; 2099</footer>
</div>
@endsection
@extends("base")

@section("title", "10 ways! You won't follow the last!")

@section("content")
@include("common")
@endsection
@extends("base", ["special" => true])

@section("title", "Welcome")

@section("content")
<div id="start">
    Other stuff
</div>
<div id="wooo">
    <main>
        @include("common")
    </main>
    <footer>&copy; 2099</footer>
</div>
@endsection
So much content.
@extends('base')

@section('body-content')

    <header>
        website
    </header>
    <main>
        @yield("content")
    </main>
    <footer>&copy; 2099</footer>

@endsection
@extends('base')

@section('body-content')
    <main>
        @yield("content")
    </main>
@endsection
@extends('base'))
@节(“正文内容”)
@产量(“含量”)
@端部
现在只需扩展您需要的模板