dongyin5516 2017-02-27 06:01
浏览 157
已采纳

Laravel:找不到Layouts.master

I built the demosite in Laravel, but I got the following error:

ErrorException in FileViewFinder.php line 137: View [layouts.master] not found.(View: /var/www/html/project/laravel/laravel/resources/views/page.blade.php)

The master.blade.php is next to the page.blade.php, both are in resources/views

master.blade.php

<html>
    <head>
        <title>@yield('title')</title>
    </head>
    <body>
        @section('sidebar')
        This is the master sidebar.
        @show
        <div class="container">
        @section('content')
        </div>
    </body>
</html>

page.blade.php

@extends('layouts.master')
@yield('title', 'Page Title')
@section('sidebar')
@parent
<p>This is appended to the master sidebar.</p>
@endsection
@section('content')
<h2>{{$name}}</h2>
<p>This is my body content.</p>
@endsection

What goes wrong? I working from this tutorial.

  • 写回答

2条回答 默认 最新

  • doulun7739 2017-02-27 06:03
    关注

    Try

    @extends('master')
    

    They are both at the views root you said. Or create a directory called layouts and place master.blade.php inside.

    Updates In your master.blade.php where you want your content to be "injected", do:

    @yield('content')
    //remove @section('content') because your master does not extends any other layout
    

    The exact same way you did with @yield('title').

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?