0

Взял пример с документация Laravel Скопировал код шаблона:

<!-- Файл resources/views/layouts/master.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>
и дочерней страницы:

@extends('layouts.master')

@section('title', 'Page Title')

@section('sidebar')
    @

    <p>This is appended to the master sidebar.</p>
@endsection

@section('content')
    <p>This is my body content.</p>
@endsection

В результате получил следующий вывод :

@

This is appended to the master sidebar.

This is my body content.

Хотя, на сколько я понял, вместо @ должно было подставиться содержимое секции sidebar, определенное в шаблоне, то есть должно было быть выведено следующее:

This is the master sidebar.

This is appended to the master sidebar.

This is my body content.

Помогите, пожалуйста, разобраться.

1 ответ 1

0

Это ошибка в документации. Вместо @ должно быть @parent

Это можно увидеть из этого примера в официальной документации: https://laravel.com/docs/5.7/blade#extending-a-layout

2

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.