laravel @layouts不起作用

埃文大帝

我刚刚安装了第一个laravel应用程序,我想使用布局创建简单的入门项目。我在Google / youtube上阅读了很多教程和视频,我尝试使用“复制和粘贴”进行编码,但是在我的项目中复制的代码无法正常工作。

该项目是关于laravel官方站点(与作曲家)的描述而生成的。

我创建了一个布局文件夹概述-并且创建了一个名为它的文件:main.blade.php-我希望您将此文件用作视图下的布局,我有一个文件夹home/home.blade.php-这是我的内容文件。

BaseController.php我设定

protected $layout = 'main';//layouts.main

HomeController.php

protected $layout = 'main';//layouts.main 

public function showWelcome()
{
    return View::make('hello');
}

main.blade.php

html code for header

@yield('content') // content from hello.blade.php should be replaced here

html code for footer

hello.blade.php

//no enter no space here
@extend('main') //@extend('layouts.main')
@section('content')

html content here

@endsection //@stop - tried with stop too

route.php

Route::get('/', function()
{
    return View::make('home.hello');
});

在显示时,我仅得到以下结果行作为文本:“ @extend('main')

阿尔伯特221
@extend

您忘记了“ s”,它一定是 @extends

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章