PHP code example of xing.chen / yii-article

1. Go to this page and download the library: Download xing.chen/yii-article 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/ */

    

xing.chen / yii-article example snippets


'xingUploader' => [
    // 前端访问路径
    'visitDomain' => IMG_DOMAIN . 'upload/',
    // 上传url
    'uploadUrl' => 'article/file-upload/xing',
    'config' => [
        'defaultImage' => '/images/icon/upload.jpg',
        'disableGlobalDnd' => true,
        'accept' => [
            'title' => 'Images',
            'extensions' => 'jpg,jpeg,bmp,png',
            'mimeTypes' => 'image/jpg,image/jpeg,image/png,image/bmp',
        ],
        'pick' => [
            'multiple' => false,
        ],
    ],
]


    'modules' => [
        'article' => [
            'class' => 'xing\article\backend\Module',
        ],
    ],

'components' => [
    'upload' => [
        'class' => 'xing\upload\core\YiiFactory',
        # 默认使用驱动
        'driveName' => 'ali',
        'config' =>[
            // oss配置
            'ali' => [
                'OSS_ACCESS_ID' => 'OSS_ACCESS_ID',
                'OSS_ACCESS_KEY' => 'OSS_ACCESS_KEY',
                'OSS_ENDPOINT' => 'oss 里的ENDPOINT',
                'UploadBucket' => 'Bucket名称',            //上传到云存储服务器的bucket名字
                'UploadDomain' => 'xxx.com',    //上传文件的Bucket可以自定义域名,对于不同的Bucket使用不同的自定义域名
                'domain' => 'http://xxx.com/',
                'relativePath' => 'upload/',
            ],
            // 上传到自有服务器配置
            'yii' => [
                'uploadPathRoot' => '@api/web/',
                'maxSize' => 2048000,
                'domain' => 'http://xxx.com/',
                'relativePath' => 'upload/',
            ],
        ],
    ]
    ];

namespace 命名空间请自己根据情况加入;
use xing\article\logic\TemplateLogic;
use Yii;

class ArticleController extends \yii\web\Controller
{
    use \apps\frontend\controllers\ArticleBaseController;

}

use \xing\article\backend\controllers\ArticleBaseTrait;


    // 全部使用自已的模板
    public $viewPath = '模板路径,留空为正常后台路径';
    // 仅自定义修改和创建模板
    public function beforeAction($action)
    {
        parent::beforeAction($action);
        switch ($action->id) {
            case 'update':
            case 'create':
                $this->viewPath = '';
        }
        return true;
    }

正在开发

'multilingual' => true,

php yii migrate --migrationPath=@xing/article/migrations

php yii migrate --migrationPath=@xing/article/migrations-admin-rule