ogheo/yii2-comments

Yii2的评论模块

安装: 778

依赖者: 0

建议者: 0

安全: 0

星标: 11

关注者: 5

分支: 9

公开问题: 1

类型:yii2-extension

1.0.1 2017-09-06 21:20 UTC

This package is not auto-updated.

Last update: 2024-09-14 10:58:39 UTC


README

为Yii2提供的评论模块。

安装

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

try

composer require "ogheo/yii2-comments:*"

或在你的composer.json文件的require部分添加

"ogheo/yii2-comments": "*"

配置

数据库迁移

php yii migrate/up --migrationPath=@vendor/ogheo/yii2-comments/src/migrations

模块设置

'modules' => [
    'comments' => [
        'class' => 'ogheo\comments\Module',
    ]
]

所有可用选项可以在评论模块文件中查看。

使用

将以下示例之一添加到视图文件中。

基本示例

模型不是必需的,评论将与当前URL关联。

use ogheo\comments\widget\Comments;
    
echo Comments::widget();

高级示例

要更改默认设置,你可以这样做

use ogheo\comments\widget\Comments;
    
echo Comments::widget([
    'model' => $model,
    'model_key' => $model_key,
]);

所有可用选项可以在评论小部件文件中查看。

祝您玩得开心 ;)

演示图片

demo