mardi 6 février 2018

Is there a way to incorporate a laravel with a swiper slider


I am new to laravel so this might be a dumb question but I am trying to reduce duplication in my code using partials as each page on my app has a swiper slideshow.

I first created a partial in slider.blade.php:

<div class="swiper-container">
    <div class="swiper-wrapper">
        @yield('slide-image')
    </div>

    <div class="swiper-pagination swiper-pagination-white"></div>

    <div class="swiper-button-next swiper-button-white"></div>
    <div class="swiper-button-prev swiper-button-white"></div>
</div>

I then incorporated the partial in the main.blade.php file.

<!DOCTYPE html>
<html lang="en">

@include('partials._head')
<body>

@include('partials._pageloader')
@include('partials._navbar')

@include('partials._slider') <!---- Here  ---->
@yield('content')


@include('partials._scrolltotop')   

@include('partials._footer')

@include('partials._bottom')


</body>

</html>

To add the slide on the homepage, for example, have added the slider image section.

@extends('main')

@section('title', 'Dialhouse Hotel')
@section('slide-image', 'div class="swiper-slide" style="<img src="http://dialhousehotel.com/wp-content/uploads/2017/07/1.jpg" alt="project-1" heigth="360px" width="360px">"></div>')
@section('content')



    @include('partials._contactform')

    @include('partials._googlemaps')

@endsection   

However, The problem is the image does not appear on the page. It outputs <div class="swiper-slide" style="<img src="http://dialhousehotel.com/wp-content/uploads/2017/07/1.jpg" alt="project-1" heigth="360px" width="360px">"></div> as a string.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire