2017 © Pedro Peláez
 

asgard-module ibanners-module

image

imagina/ibanners-module

  • Wednesday, July 4, 2018
  • by imagina
  • Repository
  • 1 Watchers
  • 0 Stars
  • 69 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 50 % Grown

The README.md

Ibanners Module

Special Thanks

to Nicolas Widart for AsgardCMS and his Menu Module, that was used as a foundation for the Banners Ads Module., (*1)

Installation

You can install Banners Ads module using composer: composer require imagina/ibanners-module, (*2)

After the module is installed, you have to give yourself access in AsgardCMS (using Roles/Permissions). New Banners Ads item will appear in the Sidebar, (*3)

Usage

Prerequisites

By default, Ibanners module is created using Bootstrap Carousel http://getbootstrap.com/javascript/#carousel so make sure you have all prerequisites loaded for standard Bootstrap carousel (Bootstrap Carousel CSS and JS), (*4)

Basic Usage

You can create basic Banners Ads using the AsgardCMS admin interface - you can create and name your slider (pay attention to the System Name field here, it is used later for rendering), and create individual slides. Slides can be linked to images in the Media module, or have URL pointing to external image. They can also contain hyperlink to any page on the site, fixed URI or URL., (*5)

When the slider is created, you can render it in your template using {!! BannerAds::render('slider_system_name') !}}, (*6)

Advanced Usage

Use your own slider template

If you want to change rendering of your slider, use custom HTML, CSS classes, etc, you can pass a Blade template name as a second parameter to the render() method, i.e. {!! BannerAds::render('position_system_name', 'position/my-own-banner') !}}, (*7)

Template may look like this:, (*8)

{-- Themes/MyTheme/views/banners/my-own-banner.blade.php --}


@foreach($position->sbanner as $index => $banner) @endforeach

You will have Modules\Ibanners\Entities\Position instance available in the $position variable, (*9)

Provide your own Position instance

You can also pass a Modules\BannerAds\Entities\Position instance as a first parameter instead of the slider system_name to render dynamically created slider., (*10)

First, create instance of your slider and add slides in your controller and pass it to the view, (*11)

<?php
...
// 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);
    }

then, inside of the homepage.blade.php template, you can render bannerr using {!! BannderAds::render($myBannerAds) !!}, (*12)

Resources

The Versions

04/07 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina

04/07 2018

3.0.3

3.0.3.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina

08/02 2018

3.0.2

3.0.2.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina

28/09 2017

3.0.1

3.0.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina

27/09 2017

3.0.0

3.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina

14/03 2017

2.0.0

2.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina