PHP code example of dungang / yii2-duoshuo

1. Go to this page and download the library: Download dungang/yii2-duoshuo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dungang / yii2-duoshuo example snippets


    dungang\duoshuo\widgets\Thread::widget([
        'id'=>'请将此处替换成文章在你的站点中的ID',
        'image'=>'文章图片地址,将用于转发时的附图',
        'title'=>'请替换成文章的标题',
        'url'=>'请替换成文章的网址',
        'authorId'=>'作者在本站中的id',
        'formPosition'=>'该页面中评论框的位置',
        'limit'=>'单页显示评论数',
        'order'=>'排序方式',
    ]);
   

    dungang\duoshuo\widgets\RecentComments::widget([
        'numItems'=>'5', //显示最新评论的条数,最大支持200条
        'showAvatars'=>'1', //是否显示头像,1:显示,0:不显示
        'showTime'=>'1', //是否显示时间,1:显示,0:不显示
        'showTitle'=>'1', //是否显示标题,1:显示,0:不显示
        'showAdmin'=>'1', //是否显示管理员的评论,1:显示,0:不显示
        'excerptLength'=>'70', //最大显示评论汉字数
    
    ]);