本文介绍了包括标头放在错误的位置Laravel 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图首先包含header.blade.php而不是内容,但这包括错误的方式.
I'm trying to include header.blade.php first and than content, but it includs wrong way.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<!-- include navbar / header -->
@include('site.components.header')
<!-- content -->
@yield('content')
<!-- footer -->
@include('site.components.footer')
</body>
</html>
渲染后,首先包含HTML内容,而不包含标题.
after rendering, in HTML content is included first and than header.
推荐答案
在创建可以包含某些内容的部分时,还需要像这样将其停止:
When you create a section where you can include something , you need to stop it also like:
@section('name of section here')
//Your customized content for this section.
@stop
虽然使用@show立即输出该内容,但它结束了当前节并产生了该节.屈服意味着这是该部分内容将要输出的点.
While using @show immediately outputs that content that is it ends the current section and yields it. Yielding means this is the point the content of the section will be output.
@section('name of section here')
//Your customized content for this section.
@show
这篇关于包括标头放在错误的位置Laravel 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!