【发布时间】:2017-01-03 15:32:20
【问题描述】:
我有一个视图 parent.view,其中包含另一个视图 child.view。 parent.view 扩展 parent.layout 和 child.view 扩展 child.layout。他们都有一个部分content。当包含子视图时,parent.view 的 content 被 child.view 的 content 覆盖。这似乎不是正确的行为。有没有办法解决这个问题?
父视图:
@extends('parent.layout')
@section('content')
<h1>Foo</h1>
@include('child.view')
@show
子视图:
@extends('child.layout')
@section('content')
<h1>Bar</h1>
@stop
预期结果:
<h1>Foo</h1>
<h1>Bar</h1>
实际结果:
<h1>Bar</h1>
【问题讨论】:
-
您是否尝试在您的
Child View中使用@parent? -
@TimLewis 不幸的是,包含嵌套在父标记中,因此调用
@parent只是将它放在页面的开头或结尾。
标签: laravel laravel-4 blade laravel-blade