stupidkitty / banner
Banner module for Yii2
Installs: 241
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=7.4
- yiisoft/yii2: ~2.0.38
README
Yii2 banners module
App configure module
'modules' => [
'banner' => [
'class' => SK\BannerModule\Module::class,
],
],
'container' => [
'singletons' => [
'SK\BannerModule\Banner' => [
'class' => \SK\BannerModule\Banner::class,
'templatesPath' => '@app/views/banners' // path for ad spots templates
]
]
]
Migrations
config:
'controllerMap' => [
'migrate' => [
'class' => yii\console\controllers\MigrateController::class,
'migrationNamespaces' => [],
'migrationPath' => [
'@vendor/stupidkitty/banner/src/Migration',
],
],
],
or composer:
"scripts": {
"post-update-cmd": [
"yes | php yii migrate --migrationPath=@vendor/stupidkitty/banner/src/Migration"
],
"post-install-cmd": [
"yes | php yii migrate --migrationPath=@vendor/stupidkitty/banner/src/Migration"
]
}
Usage
In template:
<?php
use SK\BannerModule\Banner;
//...
// single
<?= Banner::show('banner.name') ?>
// or multiple
<?= Banner::show(['banner.first', 'banner.second']) ?>
// Spot template. Template should exists.
<?= Banner::show(['banner.first', 'banner.second'], ['template' => 'default']) ?>