lg-xenos / yii2-banner-system
yii2 广告系统 (Banner system)
v0.9.1
2020-07-31 15:35 UTC
Requires
- kartik-v/yii2-widget-select2: ^2.1
- lg-xenos/yii2-ajaxcrud: ^2.1
- yiisoft/yii2: ^2
This package is auto-updated.
Last update: 2024-09-29 05:55:39 UTC
README
特点 (Features)
(RU)
- 展示限制不是按日期而是按数量
- 广告区域针对移动端和桌面端分别独立
- 由于 on-duplicate-key-update,设计用于在 MySql v.5+ 上运行以加快统计信息的速度
(EN)
- Impression limit by quantity, not by date
- Advert zones divided to mobile & desktop
- Work on MySql v.5+ because of on-duplicate-key-update to speed-up stat counters
要求 (Requipments)
- PHP v7+ (v5.6 - 未测试 (
not tested)) - MySql v5.6 (其他未测试 (
other not tested)) - JQuery v3+ (其他未测试 (
other not tested)) - Yii CSRF-Tokens (没有它们未测试 (
not tested without))
安装 (Installation)
composer require lg-xenos/yii2-banner-system
或者添加到 composer.json
"lg-xenos/yii2-banner-system": "*"
使用 (Usage)
(以下为英文)
将数据行添加到应用程序配置文件的两个位置(例如 frontend/config/main.php)
/* ... */ 'bootstrap' => [ /* ... */ 'adwert' /* ... */ ], /* ... */ 'modules' => [ /* ... */ 'adwert' => [ 'class' => lgxenos\yii2\banner\BannerModule::class, 'frontPrettyUrl' => '/asd/', // // ОПЦИОНАЛЬНЫЕ НАСТРОЙКИ. ТОЛЬКО ЕСЛИ ВАМ НАДО ЧТО-ТО МЕНЯТЬ // module settings 'uploadPath' => '@frontend/upload/banners/%USER_ID%/', 'uploadWebPath' => '/upload/banners/%USER_ID%/', 'userModel' => \common\models\User::class, 'userModelName' => 'username', 'mobileWidth' => 768, // yii settings 'layout' => '@frontend/modules/yiiAdmin/views/layouts/main.php', ], /* ... */ ],
执行迁移
yii migrate --migrationPath=@vendor/lgxenos/yii2-banner-system/src/migrations
现在需要
- 通过链接打开主页: https:///adwert
- 创建区域
- 创建广告
- 在 view-文件中插入代码:
\lgxenos\yii2\banner\BannerModule::setArea(AREA_ID);
English version
让我们将其添加到您的应用程序配置文件的两个位置(例如 frontend/config/main.php)
/* ... */ 'bootstrap' => [ /* ... */ 'adwert' /* ... */ ], /* ... */ 'modules' => [ /* ... */ 'adwert' => [ 'class' => lgxenos\yii2\banner\BannerModule::class, 'frontPrettyUrl' => '/asd/', // // OPTIONAL SETTINGS. IF YOU NEED CHANGE SOMETHING ONLY // module settings 'uploadPath' => '@frontend/upload/banners/%USER_ID%/', 'uploadWebPath' => '/upload/banners/%USER_ID%/', 'userModel' => \common\models\User::class, 'userModelName' => 'username', 'mobileWidth' => 768, // yii settings 'layout' => '@frontend/modules/yiiAdmin/views/layouts/main.php', ], /* ... */ ],
执行迁移
yii migrate --migrationPath=@vendor/lgxenos/yii2-banner-system/src/migrations
现在我们需要的
- 通过链接打开系统: https:///adwert
- 创建区域
- 创建广告
- 在 view-文件中插入代码:
\lgxenos\yii2\banner\BannerModule::setArea(AREA_ID);

