【发布时间】:2014-04-24 12:48:27
【问题描述】:
我一直在反复尝试制作简单的刀片模板。这是代码:
routes.php
<?php
Route::get('/', function()
{
return View::make('hello');
});
BaseController.php
<?php
class BaseController extends Controller {
/**
* Setup the layout used by the controller.
*
* @return void
*/
protected function setupLayout()
{
if ( ! is_null($this->layout))
{
$this->layout = View::make($this->layout);
}
}
}
hello.blade.php
<!DOCTYPE html>
<html>
<head>
<title>swag</title>
</head>
<body>
hello
@yield('content')
</body>
</html>
content.blade.php
@extends('hello')
@section('content')
<p>content check</p>
@stop
当我在浏览器中运行此代码时,只有我在 hello.blade.php 中编写的 hello 文本,但是 yield('content') 没有显示任何内容,我不知道为什么。非常感谢您的帮助,谢谢
【问题讨论】: