Laravel 5-(@extends,@sections,...)不起作用

时间:2018-07-17 12:26:21

标签: php html laravel laravel-5 laravel-blade

我是Laravel的新手,我在网站上尝试使所有@xy均不起作用,并且未发现问题。我的代码如下/ home:

@extends('layouts.app')

@section('content')
<h1>Home</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
@endsection

@section('sidebar')
  @parent
  <p>This is appended to the sidebar </p>
@endsection

/layouts/app.blade.php的代码如下:

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>FIXME</title>
    <link rel="stylesheet" href="/css/app.css">
  </head>
  <body>
    <div="app">
      @include('inc.navbar')

      <div class="container">
          @if(Request::is('/'))
          @include('inc.showcase')
          @endif
      </div>
      <div class="row">
      <div class="col-md-8 col-lg-8">
        @include('inc.messages')
        @yield('content')
      </div>
      <div class="col-md-4 col-lg-4">
        @include('inc.sidebar')
      </div>
    </div>
    </div>

    <footer id="footer" class="text-center">
      <p>Copyright 2018 &copy; FIXME </p>
    </footer>
  </body>
</html>

导航栏是引导模板。

1 个答案:

答案 0 :(得分:0)

<Doctype html>

<html>

<head>

   @include('includes.head')

</head>

<body>

<div class="container">

   <header class="row">

       @include('includes.header')

   </header>

   <div id="main" class="row">

           @yield('content')

   </div>

   <footer class="row">

       @include('includes.footer')

   </footer>

</div>

</body>

</html>

如果您仍然有问题或需要信息,请访问我的文章: 使用刀片模板引擎在Laravel中创建布局