I've a simple main layout:
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
@yield('style')
</head>
<body>
@include('layouts.frontend.partials.slider')
@yield('javascript')
</body>
</html>
layouts.frontend.partials.slider
@section('style')
<link rel="stylesheet" type="text/css" href="mystyle.css">
@append
@section('javascript')
<script></script>
@append
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide" data-swiper-autoplay="1000">Slide 1</div>
<div class="swiper-slide" data-swiper-autoplay="1000">Slide 2</div>
<div class="swiper-slide" data-swiper-autoplay="1000">Slide 3</div>
</div>
<div class="swiper-pagination"> </div>
<div class="swiper-button-prev"> </div>
<div class="swiper-button-next"> </div>
</div>
The @section('style')
will be ignored while the @section('javascript')
is working fine within the include file... I've reduced both files (main and include) to a minimum and swapped the position of style and javascript without any difference
What seems to be working is to change to position from the @yield('style')
to the body, like:
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
@include('layouts.frontend.partials.slider')
@yield('javascript')
@yield('style')
</body>
Maybe it's not allowed to have @section
in an include file?
What i want to archive is to have multiple partial includes with it's own css and javascript includes
Thanks
via markus