1
我的刀片結構有問題。我有一個基本佈局模板,一個內容頁面模板和子模板。Laravel刀片部分內包含視圖(bladeception)
採取以下片段作爲您的參考
基本模板
<!DOCTYPE html>
<html lang="en">
@include('head')
</head>
<body>
@include('body-open')
@yield('main')
@include('footer')
@include('body-close')
</body>
</html>
內容模板
@extends('base')
@section('main')
content
@include('my-other-section-that-has-another-section-declaration-inside')
@overwrite
@section('body.script')
this is an extended script
@stop
身體接近模板
@section('body-open')
this is the original content
@stop
我,其他截面,也就是說,有-另一截面聲明,內模板
this is cool
@section('body-open')
@parent
this should append to body open.
@stop
這是我預期的結果
<!DOCTYPE html>
<html lang="en">
</head>
<body>
this is the original content
this should append to body open.
content
this is cool
</body>
</html>
但是我得到這個內容而不是
<!DOCTYPE html>
<html lang="en">
</head>
<body>
this is the original content
content
this is cool
</body>
</html>
請注意,行這應該附加到身體打開。已被跳過,不會附加到其預期的部分。
我的代碼有問題嗎?或者這種方法可行嗎?
謝謝!
好的,會在這個問題上回復您。謝謝@ filip-koblański爲您的答案 – stephenricks1991
這是否有幫助嗎? –
是的。感謝filip! – stephenricks1991