我的刀片模板有问题。出于某种原因,我将视图的内容打印了两次,一次是yield
在我期望的位置,另一次是在扩展的视图执行任何操作之前。
我的路线是:
Route::get('/', array('as' => 'home', function () {
return View::make('default');
}));
默认视图 ( default.blade.php
) 是这样的:
@extends('test')
@section('title')
Default
@show
@section('content')
<p>Content goes here<p>
@show
测试视图 ( test.blade.php
) 是这样的:
<h1>Anything above should be be there!</h1>
<h3>@yield('title')</h3>
@yield('content')
这会产生:
Default
<p>Content goes here<p>
<h1>Anything above should be be there!</h1>
<h3>Default</h3>
<p>Content goes here<p>