elephantsgroup/yii2-comment 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

elephantsgroup/yii2-comment

Composer 安装命令:

composer require elephantsgroup/yii2-comment

包简介

Yii 2 comments module

README 文档

README

To use Elephants Group comment module first you must install module, then you can use comment widget anywhere in your website.

Installation Steps:

1) run

php composer.phar require elephantsgroup/yii2-comment "*"

or add "elephantsgroup/yii2-comment": "*" to the require section of your composer.json file.

2) migrate database

yii migrate --migratiocommentnPath=vendor/elephantsgroup/yii2-comment/migrations

3) add comment module to common configuration (common/config.php file)

    ...
    'comment' => [
        'class' => 'elephantsGroup\comment\Module',
    ],
    ...

4) open access to module in common configuration

    'class' => 'mdm\admin\components\AccessControl',
    'allowActions' => [
        ...
        'comment/ajax/*',
        ...
    ]

5) filter admin controller in frontend configuration (frontend/config.php file)

    ...
    'comment' => [
        'as frontend' => 'elephantsGroup\comment\filters\FrontendFilter',
    ],
    ...

5) filter ajax controller in backend configuration (backend/config.php file)

    ...
    'comment' => [
        'as backend' => 'elephantsGroup\comment\filters\BackendFilter',
    ],
    ...

Using comment widget

Anywhere in your code you can use comment widget as follows:


You need to use Comments widget header in your page:
```use elephantsGroup\comment\components\Comments;```

Comment widget parameters
---

- item (integer): to separate comments between different items.
```<?= Comments::widget(['item' => 1]) ?>```
```<?= Comments::widget(['item' => $model->id]) ?>```

default value for item is 0
- service (integer): to separate comments between various item types.
```<?= Comments::widget(['service' => 1, 'item' => $model->id]) ?>```

for example you can use different values for different modules in your app, and then use comment widget separately in modules.
default value for service is 0

- enabled_name (boolean): show name in comment form or not, default true
```<?= Comments::widget([
    'service' => 1,
    'item' => $model->id,
    'enabled_name' => false,
    'view_file' => Yii::getAlias('@frontend') . '/views/comment/widget.php'
]) ?>```

- enabled_subject (boolean): show subject in comment form or not, default true
```<?= Comments::widget([
    'service' => 1,
    'item' => $model->id,
    'enabled_name' => false,
    'enabled_subject' => true,
    'view_file' => Yii::getAlias('@frontend') . '/views/comment/widget.php'
]) ?>```

- enabled_description (boolean): show description in comment form or not, default true
```<?= Comments::widget([
    'service' => 1,
    'item' => $model->id,
    'enabled_name' => false,
    'enabled_subject' => true,
    'enabled_description' => true,
    'view_file' => Yii::getAlias('@frontend') . '/views/comment/widget.php'
]) ?>```

- view_file (string): the view file path for rendering

```<?= Comments::widget([
    'service' => 1,
    'item' => $model->id,
    'color' => 'yellow',
    'view_file' => Yii::getAlias('@frontend') . '/views/comment/widget.php'
]) ?>```

you can use these variables in your customized view:
* service
* item
* enabled_name
* enabled_subject
* enabled_description

统计信息

  • 总下载量: 29
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-12-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固