【发布时间】:2023-03-30 02:34:01
【问题描述】:
当 url 是子文件夹时,我的模板布局刀片不呈现。
我做了一个测试例子来检查:
网址/测试没问题
但是
URL/tests/1/edit 丢失了外部布局模板,只呈现内容。
测试控制器:
class TestController extends AdminController {
protected $layout = 'layouts.admin';
public function index()
{
// load the view
$this->layout->content=View::make('tests.index');
}
public function edit($id)
{
//
$course=Course::find($id);
return View::make('tests.edit')->with(array('course'=>$course));
}
}
布局 admin.blade.php
<html><body>
{{ $content }}
</body>
</html>
测试/index.blade.php
hello
/tests 呈现源完整布局的 html 代码并在适当的站点示例上正常工作
测试/edit.blade.php
edit
/tests/1/edit 渲染没有 HTML 布局
有多种使用刀片的方法,但我认为最简单的是使用受保护的布局,但似乎有问题?
任何帮助表示赞赏。
【问题讨论】: