[英]Laravel Blade doesn't include partial
I'm trying to add to my layout a header file like so: 我正在尝试将头文件添加到布局中,如下所示:
Views/layouts/main_layout.blade.php 视图/布局/main_layout.blade.php
@include('layouts.header.stylesheets')
the content for that file is: 该文件的内容是:
@section('stylesheets')
{{ stylesheet_link_tag('style.css') }}
@stop
but that doesn't include anything, could you please tell me what am I doing wrong? 但这不包含任何内容,您能告诉我我做错了什么吗?
If you are including a file, you just do this: 如果要包含文件,则只需执行以下操作:
Views/layouts/main_layout.blade.php 视图/布局/main_layout.blade.php
@include('layouts.header.stylesheets')
Then in your other file: 然后在另一个文件中:
{{ stylesheet_link_tag('style.css') }}
You only use @section
if you are @yielding
to that file 仅在@yielding
到该文件时才使用@section
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.