Installation
The preferred way to install this extension is through composer., (*1)
Either run, (*2)
composer require isaurssaurav/yii2-comment
or add, (*3)
"isaurssaurav/yii2-comment": "*"
to the require section of your composer.json.
Font Awesome is required*, (*4)
Configuration
Database Migrations, (*5)
Before using Comments Widget, we'll also need to prepare the database., (*6)
php yii migrate --migrationPath=@vendor/isaurssaurav/yii2-comment/migration
Module setup
To access the module, you need to add the following code to your application configuration:, (*7)
'modules' => [
'comment' => [
'class' => 'isaurssaurav\yii\comment\Module',
],
]
Usage
Basic example:, (*8)
use isaurssaurav\yii\comment\widgets\CommentWidget;
//echo where you want to show comment
echo CommentWidget::widget();
Properties
1.limit
Default value is 2
No of comment you want to show at first.This number also controls number of comment shown after LOAD MORE is clicked
2.sort
ASC or DESC
3.recognize_schema
Defaultly it catches current url, but You can changed it to idk page_id or something, (*9)
use isaurssaurav\yii\comment\widgets\CommentWidget;
//echo where you want to show comment
echo CommentWidget::widget([
limit => 10,
sort => DESC,
]);
, (*10)