isaurssaurav/yii2-comment

轻量级的 Yii2 评论小部件

安装次数: 34

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 1

开放问题: 1

类型:yii2-extension

1.0.0 2017-01-17 12:49 UTC

This package is not auto-updated.

Last update: 2024-09-28 19:52:52 UTC


README

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

运行以下命令之一

composer require isaurssaurav/yii2-comment

或添加

"isaurssaurav/yii2-comment": "*"

到你的 composer.json 文件的 require 部分。需要安装 Font Awesome*

配置

数据库迁移

在使用评论小部件之前,我们还需要准备数据库。

php yii migrate --migrationPath=@vendor/isaurssaurav/yii2-comment/migration

模块设置 要访问模块,您需要将以下代码添加到您的应用程序配置中

'modules' => [
    'comment' => [
        'class' => 'isaurssaurav\yii\comment\Module',
    ],
]

用法

基本示例

use isaurssaurav\yii\comment\widgets\CommentWidget;

//echo where you want to show comment
 echo CommentWidget::widget();

属性

1.limit 默认值是 2,表示您希望首次显示的评论数量。此数字还控制点击“加载更多”后显示的评论数量 2.sort ASC 或 DESC 3.recognize_schema 默认情况下它会捕获当前 URL,但您可以将它更改为 idk page_id 或其他内容

use isaurssaurav\yii\comment\widgets\CommentWidget;

//echo where you want to show comment
 echo CommentWidget::widget([
	limit => 10,
	sort => DESC,
]);

demo.png