voV/yii2-announcement

在前端和后端编写和读取公告

安装次数: 58

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:yii2-extension

0.9.7 2015-10-19 14:36 UTC

This package is not auto-updated.

Last update: 2024-09-28 18:58:34 UTC


README

公告模块允许您拥有具有无限嵌套分类和地区的公告板

安装

安装此扩展的首选方式是通过 composer

运行以下命令

php composer.phar require --prefer-dist vov/yii2-announcement "*"

或添加

"vov/yii2-announcement": "*"

迁移

您可以使用 console/migartions 中已经存在的迁移

	$ yii migrate --migrationPath='@vov/announcement/console/migrations'

	$ yii migrate --migrationPath=@vendor/vov/yii2-announcement/console/migrations

它将创建以下表格:1. an_cats - 分类 2. an_regions - 包含乌克兰所有地区(uk-UA)的数据 3. an_items - 广告

配置

按照以下方式配置 common/config

    'modules' => [
        'announcement' => [
            'class' => 'vov\announcement\Module',
        ],
    ],

按照以下方式配置 backend/config

    'modules' => [
        'announcement' => [
            'controllerNamespace' => 'vov\announcement\backend\controllers',
        ],
    ],

使用方法

要访问前端:http://example.com/announcement/anitems http://example.com/announcement/anitems/create

要访问后端:http://backend.example.com/announcement/anitems http://backend.example.com/announcement/ancats http://backend.example.com/announcement/anregions

您还可以在需要的地方使用小部件,如下所示

   <?= \vov\announcement\widgets\Announcement::widget([
       'perPage' => 5,
   ]); ?>

生成模块翻译

	$ yii message vendor/vov/yii2-announcement/messages/config.php