PHP code example of imagina / ibanners-module

1. Go to this page and download the library: Download imagina/ibanners-module 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');

/* Start to develop here. Best regards https://php-download.com/ */

    

imagina / ibanners-module example snippets


{-- Themes/MyTheme/views/banners/my-own-banner.blade.php --}
<div id="{{ $position->system_name }}" class="my-own-slider-class">

    @foreach($position->sbanner as $index => $banner)
        <div class="banner">
            <a href="{{ $banner->getLinkUrl() }}">
                <img src="{{ $banner->getImageUrl() }}" />
            </a>
        </div>
    @endforeach
    
</div>


...
// import classes needed to create your own instance
use Modules\Ibanners\Entities\Position;
use Modules\Ibanners\Entities\Banner;

class HomepageController {
    ...
    /**
     * controller method
     */
    public function displayHomepage()
    {
        // make a new Slider instance
        $bannerAds = new Position;
        $bannerAds->system_name = 'custom_slider';
        
        // create slide 1
        $banner = new Slide;
        $banner->title = 'First Slide';
        $banner->caption = 'First banner text';
        $banner->external_image_url = 'https://placeholdit.imgix.net/~text?txtsize=33&txt=Slide1&w=800&h=300';
        
        // create banner 2
        $banner2 = new Slide;
        $banner2->title = 'Second Slide';
        $banner2->caption = 'Second banner text';
        $banner2->external_image_url = 'https://placeholdit.imgix.net/~text?txtsize=33&txt=Slide2&w=800&h=300';
        
        // add banners to bannerr
        $bannerAds->banners->add($banner);
        $bannerAds->banners->add($banner2);
        
        // render view
        return View::make('homepage')
            ->with('mySlider', $bannerAds);
    }