loktionov/yii2-superbanner

Generate banners for the Yii framework

Installs: 15

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2015-03-30 18:02 UTC

This package is not auto-updated.

Last update: 2024-10-26 18:06:27 UTC


README

Генерация кода рекламных баннеров

Config

'components' => [
'superbanner' => [
            'class'=>'loktionov\superbanner\Superbanner',
            'bannercount' => 100,
        ]
]

Controller

$sb = Yii::$app->superbanner;
//или так, если не объявлять как компонент в конфиге
$sb = new Superbanner();

$s1 = $sb->GetBanners(12);
$s2 = $sb->GetBanners(24);
$s3 = $sb->GetBanners('18%', 'superbanner2');
$s4 = $sb->GetBanners('56');

$s5 = Yii::$app->superbanner->GetBanners(12);

return $this->render('index', ['banners'=>$s3]);

View

foreach($banners as $b) {
    echo $b;
}
$this->registerJs(
    '$("document").ready(function(){
     var hsh = window.location.hash.substring(1);
     if(hsh != "")
      $("#" + hsh).css("border", "1px solid red");
    });'
);