0
我有一個文件夾中查看:在Laravel使用刀片時如何安排內容的顯示位置?
resources -> view
- layouts
+ master.blade.php
- partials
+ footer.blade.php
+ header.blade.php
- news
+ show.blade.php
+ list.blade.php
- apartment
+ show.blade.php
我的代碼在master.blade.php
:
<head>
<script src="{{{ URL::asset('js/theme.min.js')}}}"></script>
</head>
<body>
<div class="main-container">
@include('partials.header')
@yield('content')
@include('partials.footer')
</div>
</body>
在news>show.blade.php
:
@extends('layouts.master')
@section('content')
<div class="show-news">show all news at here</div>
@stop
在apartment>show.blade.php
:
@extends('layouts.master')
@section('content')
<div class="show-apartment">show all apartment at here</div>
@stop
在HTML文件中有結構一樣:
header
content
- show slider image
- show list news
- show list apartment
footer
因爲所有文件與section('content')
定義。
我不知道如何使用我的HTML文件正確排列section('content')的顯示位置。
我想應該是這樣的:
在news>show.blade.php
:@section( '新聞')
在apartment>show.blade.php
:@section( '公寓')
在master.blade.php
:
<head>
<script src="{{{ URL::asset('js/theme.min.js')}}}"></script>
</head>
<body>
<div class="main-container">
@include('partials.header')
@yield('news')
@yield('apartment')
@include('partials.footer')
</div>
</body>
但是我幾乎看到項目上都不這樣用。