PHP code example of seiger / sgallery
1. Go to this page and download the library: Download seiger/sgallery library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once ('vendor/autoload.php' );
seiger / sgallery example snippets
@foreach (sGallery::collections()->get() as $item)
@if (sGallery::hasImage($item->type))
<a class ="swiper -slide " @if (trim ($item ->link ))href =" {{$item->link}}"@endif>
<div class=" container">
<img loading=" lazy" class=" intro__img" src=" {{$item->src}}" alt=" {{$item->alt}}" width=" 1440 " height=" 456 ">
<div class=" intro__inner">
<div class=" h1__title">{{$item->title}}</div>
<p class=" intro__text">{{$item->description}}</p>
@if(trim($item->link_text))<div class=" btn background__mod">{{$item->link_text}}</div>@endif
</div>
</div>
</a>
@endif
@endforeach
@foreach (sGallery::collections()->get() as $item)
@if (sGallery::hasYoutube($item->type))
<div class ="item ">
<div class ="video ">
<iframe width ="560" height ="315" src ="https ://www .youtube .com /embed / {{$item->file}}" title=" YouTube video player" allow=" accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<p>{{$item->title}}</p>
</div>
@endif
@endforeach
@foreach (sGallery::collections()->documentId($product->id)->itemType('product' )->get() as $item)
<div class ="swiper -slide ">
<a class ="js -trigger -fancybox " href =" {{$item->src}}" data-fancybox=" product-gallery">
<img loading=" lazy" src=" {{$item->src}}" width=" 440 " height=" 440 " />
</a>
</div>
@endforeach
{!!sGallery::initialiseView()->viewType('section' )->itemType('product' )->idType('i' )!!}
console
php artisan package:install
console
php artisan vendor:publish --provider="Seiger\sGallery\sGalleryServiceProvider"
console
php artisan migrate
console
core/custom/config/seiger/settings/sGallery.php