【发布时间】:2017-01-29 19:37:05
【问题描述】:
如何使用 Laravel Blade 模板引擎的 @include 加载页面特定资源?
下面是我的Master布局的内容(master.blade.php):
<head>
@section('styles')
{{-- Some Master Styles --}}
@show
</head>
<body>
{{-- Header --}}
@section('header')
@include('header')
@show
{{-- Content --}}
@section('content')
{{-- Content for page is extending this view --}}
@show
{{-- Footer --}}
@section('footer')
@include('footer')
@show
</body>
在给定的页面中,我以这种方式使用我的主模板:
@extends('master')
@section('styles')
@parent
{{-- Page Stylesheet --}}
@endsection
上面的方法是我用来尝试将我的页面特定样式加载到<head> 部分的方法。
它没有按预期正常工作。
我还想使用相同的方法在我的页脚中加载其他特定于页面的资源;我怎样才能有效地做到这一点?
【问题讨论】:
标签: php laravel blade laravel-blade laravel-5.3