thyseus/yii2-banner

Yii2 的横幅广告管理器

安装: 738

依赖项: 0

建议者: 0

安全: 0

星星: 0

分支: 0

类型:yii2-extension

dev-master 2018-12-20 13:03 UTC

This package is auto-updated.

Last update: 2024-09-21 02:15:32 UTC


README

在您的页面上放置广告横幅。

  • 广告从起始日期到结束日期有效
  • 横幅可以出现的位置多个
  • 活跃横幅随机放置
  • 使用短链接在URL中识别横幅
  • 统计横幅访问量

安装

$ composer require thyseus/yii2-banner
$ php yii migrate/up --migrationPath=@vendor/thyseus/yii2-banner/migrations

配置

将以下行添加到您的配置文件中

'modules' => [
    'banner' => [
        'class' => 'thyseus\banner\Module',
        'allowedRoles' => ['admin', 'banner'], # which roles are allowed to administrate banners?
    ],
],

放置横幅

将此片段放置在您希望相应广告区域显示的视图中

<?php
    echo $this->render('@vendor/thyseus/yii2-banner/views/banner/_banner', ['adspace' => 'location_header_top']);
    echo $this->render('@vendor/thyseus/yii2-banner/views/banner/_banner', ['adspace' => 'location_header_right']);
    echo $this->render('@vendor/thyseus/yii2-banner/views/banner/_banner', ['adspace' => 'location_header_bottom']);

操作

以下操作是可能的

为此项目做出贡献

任何人都可以为此项目做出贡献。

许可证

Yii2-banner 在 GPLv3 许可证下发布。