[英]Laravel yield and extends not working
This is master.blade.php placed in views folder 这是放置在views文件夹中的master.blade.php
<html ng-app="planner">
<head>
<title>MeetUp Planner</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/master.css" type="text/css">
</head>
<body ng-controller="MainController">
<div class="container" ng-controller="MainController">
<div class="row row-centered planner-block">
<div class="col-md-12">
<div class="col-md-5 col-centered col-min form-area">
<div class="row row-centered">
@yield('signup')
</div>
</div>
</div>
</div>
</div>
<script src="js/master.js"></script>
</body>
</html>
This is forms/signup.blade.php place in views folder 这是views / signup.blade.php放置在views文件夹中
@extends('master')
@section('signup')
<div class="col-md-11 col-centered form-area-inner">
<span class="form-text">Sign Up</span>
<hr class="seperator"/>
</div>
@stop
This is routes file 这是路径文件
<?php
Route::get('/', function () {
return view('master');
});
The yield 'signup' is not wokring, the divs and text are not being show in the master file. 产量'注册'不会生成,div和文本不会显示在主文件中。 What could be the problem? 可能是什么问题呢?
Directory Structure 目录结构
resources:
---views->errors
---views->forms->signup.blade.php
---views->vendor
---views->master.blade.php
Using laravel 5.2 使用laravel 5.2
That's not how it works. 这不是它的工作原理。 master
view will be extended when you'll use forms.signup
view: 当您使用forms.signup
视图时,将扩展master
视图:
Route::get('/', function () {
return view('forms.signup');
});
If you want to include some view into master
view, you should use @include()
clause. 如果要在master
视图中包含一些视图,则应使用@include()
子句。
your route file will be 你的路线文件将是
<?php
Route::get('/', function () {
return view('forms.signup');
});
?>
change the location of master.blade.php 更改master.blade.php的位置
move it to ---resources/views/layouts/master.blade.php 将其移至--- resources / views / layouts / master.blade.php
in your master.blade.php file change this line 在master.blade.php文件中更改此行
@yield('signup')
to @yield('content')
@yield('signup')
到@yield('content')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.