2017-06-16 119 views
0

我main.blade.phpLaravel刀片@yield和@section

<div class="container"> 
    @yield('content') 
</div> 

@extends('main') 

    @section('content') 
    <div class="row"> 
     <h1>this content should show on my main</h1> 
    </div> 
    @endsection 

可能是錯誤它不顯示在我的內容@部分我沒有錯誤,但它不工作的方式我使用Laravel 5.4

+0

其中主要的PHP在什麼位置?而家位於刀片哪裏? – Exprator

+0

@exprator他們都位於資源和內部視圖文件夾 – Lestah

+0

意味着兩者都在同一目錄中嗎?像main.php,home.php? – Exprator

回答

-1

我認爲你需要更新你的代碼爲main.blade.ph p像:

<div class="container"> 
    @yield('content') 
</div> 

<section class="content"> 
    @yield('content') 
</section> 

希望這對你的工作

+0

它沒有不工作T_T – Lestah

+0

我很驚訝,如何更改'div'到'section'可以解決問題? –

+0

@Bhavik Shah nah它沒有 – Lestah

0

確保您main.blade.php和home.blade.php在於 resource/views/

如果它們位於不同的目錄使用 」 。 「指定目錄

例如,如果main.blade.php是resource/views/layouts那麼它會是這樣的@extends('layouts.main')

+0

是他們都在資源文件夾內的資源 – Lestah

+0

你得到的輸出是什麼 –

+0

什麼東西應該顯示在main.blade.php上的內容不包括在我檢查頁面源時 – Lestah