krptograf / yii2-mforum

为 yii2 的论坛模块扩展

安装: 55

依赖: 0

建议者: 0

安全: 0

星标: 1

关注者: 2

分支: 1

开放问题: 0

类型:yii2-extension

dev-master 2016-12-07 12:41 UTC

This package is auto-updated.

Last update: 2024-09-29 04:49:14 UTC


README

为 yii2 的论坛模块扩展

安装

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

运行以下命令之一

php composer require --prefer-dist kriptograf/yii2-mforum "*"

或者

"kriptograf/yii2-mforum": "*"

将以下内容添加到您的 composer.json 文件的 require 部分。

配置

将以下行添加到您的主配置文件中

'modules' => [
    ...
    'forum' => [
        'class' => 'kriptograf\mforum\Module',
        'defaultRoute'=>'forum/index'
    ],
    //depends extensions
    'markdown' => [
        'class' => 'kartik\markdown\Module',
    ],
    'attachments' => [
    	'class' => nemmo\attachments\Module::className(),
    	'tempPath' => '@app/uploads/temp',
    	'storePath' => '@app/uploads/store',
    	'rules' => [ // Rules according to the FileValidator
    		'maxFiles' => 10, // Allow to upload maximum 3 files, default to 3
    		'mimeTypes' => 'image/png', // Only png images
    		'maxSize' => 1024 * 1024 // 1 MB
    	],
    	'tableName' => '{{%attachments}}' // Optional, default to 'attach_file'
    ]
    ... 
 ]
 

在 common/params.php 中添加发送者信息

'forumEmailSender'=>'info@yousite.com',

更新数据库模式

最后,您需要通过应用迁移来更新您的数据库模式。确保您已正确配置了 db 应用程序组件,并运行以下命令

$ php yii migrate/up --migrationPath=@vendor/kriptograf/yii2-mforum/migrations
$ php yii migrate/up --migrationPath=@vendor/nemmo/yii2-attachments/src/migrations

用法

扩展安装完成后,只需在代码中通过

<?= Url::toRoute(['/forum']); ?>```