w3lifer/yii2-disqus

Installs: 54

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

1.2.0 2018-03-28 18:12 UTC

This package is auto-updated.

Last update: 2024-03-20 04:13:23 UTC


README

Installation

composer require w3lifer/yii2-disqus

Usage

Note, that the number of comments and settings related to comments (https://disqus.com/admin/settings/community) are updated approximately every 20 minutes.

/**
 * @var $this \yii\web\View
 */

use w3lifer\yii2\Disqus;

// Widget

echo Disqus::widget([
    'shortName' => '<short name>', // Required
    'pageUrl' => '<page url>', // Optional
    'pageIdentifier' => '<page identifier>', // Optional
    'language' => '<language>', // Optional; default `Yii::$app->language`
    'callbacks' => [ // Optional; sinse 1.2.0
        'onReady' => 'function () { alert("onReady"); }', // String
        'onNewComment' => [ // Array
            'function () { alert("onNewComment 1"); }',
            'function () { alert("onNewComment 2"); }',
        ],
    ],
]);

// Number of comments (since 1.1.0)

Disqus::widget([
    'shortName' => '<short name>', // Required
    'onlyCountComments' => true,
]);