Including header in wrong place Laravel 4

十年热恋 提交于 2019-12-23 17:05:21

问题


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>

after rendering, in HTML content is included first and than header.


回答1:


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

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


来源:https://stackoverflow.com/questions/30498281/including-header-in-wrong-place-laravel-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!