mrstroz/yii2-wavecms

Yii2 WaveCMS

安装次数: 310

依赖: 5

建议者: 0

安全: 0

星标: 3

关注者: 2

分支: 0

开放问题: 10

类型:yii2-extension


README

Yii2 WaveCMS

建议在 Yii 2 高级项目模板 上安装

安装

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

运行

composer require --prefer-source "mrstroz/yii2-wavecms" "~0.2.5"

或添加

"mrstroz/yii2-wavecms": "~0.2.5"

到您的 composer.json 文件的 require 部分。

所需步骤

  1. 更新 backend/config/main.php(Yii2 高级模板)
'modules' => [
    // ...   
    'wavecms' => [
        'class' => 'mrstroz\wavecms\Module',
        'languages' => ['en','pl']
    ],
],
// ...
'components' => [
    // ...
    'user' => [
        'identityClass' => 'mrstroz\wavecms\models\User', //Change identity class
        // ...
    ],
]
// ...
'controllerMap' => [
    'elfinder' => [
        'class' => 'mihaildev\elfinder\Controller',
        'access' => ['@'],
        'disabledCommands' => ['netmount'],
        'roots' => [
            [
                'baseUrl'=>'@frontWeb',
                'basePath'=>'@frontWebroot',
                'path' => 'userfiles',
                'name' => 'Files'
            ]
        ]
    ]
]
  1. 取消注释 urlManager 部分,并在 backend/config/main.php 中添加 .htaccess

  2. 更新 common/config/main.php(Yii2 高级模板)

'components' => [
    'authManager' => [
        'class' => 'yii\rbac\DbManager',
    ],
]
  1. 运行迁移

console/config/main.php 中添加 migrationPath 并运行 yii migrate

// Add migrationPaths to console config:
'controllerMap' => [
    'migrate' => [
        'class' => 'yii\console\controllers\MigrateController',
        'migrationPath' => [
            '@app/migrations',
            '@yii/rbac/migrations/',
            '@yii/i18n/migrations/',
            '@vendor/mrstroz/yii2-wavecms/migrations/',
            '@vendor/yii2mod/yii2-settings/migrations/'    
        ],
    ],
],

或直接运行迁移

yii migrate --migrationPath=@yii/rbac/migrations
yii migrate --migrationPath=@yii/i18n/migrations/
yii migrate --migrationPath=@vendor/mrstroz/yii2-wavecms/migrations
yii migrate --migrationPath=@vendor/yii2mod/yii2-settings/migrations
  1. 更新 console/config/main.php(Yii2 高级模板)
'modules' => [
    // ...
    'wavecms' => [
        'class' => 'mrstroz\wavecms\Module'
    ],
],
  1. 添加新的 WaveCMS 用户
yii wavecms/create [email] [password]

覆盖类

类可以通过

  1. WaveCMS 模块的 classMap 属性来覆盖
'modules' => [
    // ...   
    'wavecms' => [
        'class' => 'mrstroz\wavecms\Module',
        'languages' => ['en','pl'],
        'classMap' => [
            'User' => \common\models\User::class
        ]
    ],
],
  1. backend/config/main.php 中配置 Yii2 依赖注入
'container' => [
    'definitions' => [
        mrstroz\wavecms\models\User::class => common\models\User::class
    ],
],

覆盖控制器

使用 WaveCMS 模块的 controllerMap 属性来覆盖控制器

'modules' => [
    // ...   
    'wavecms' => [
        'class' => 'mrstroz\wavecms\Module',
        'languages' => ['en','pl'],
        'controllerMap' => [
            'user' => 'backend\controllers\UserController'
        ]
    ],
],

覆盖视图

使用 主题 来覆盖视图

'components' => [
    // ...
    'view' => [
        'theme' => [
            'basePath' => '@app/themes/basic',
            'baseUrl' => '@web/themes/basic',
            'pathMap' => [
                '@wavecms/views' => '@app/themes/basic/wavecms',
            ],
        ],
    ],
    // ...
],

多语言

  1. 许多语言可以通过 yii2-localeurls 来处理。按照 Locale Urls 安装的所有步骤进行。

  2. backend/config/main.php 中为 WaveCMS 模块设置 CMS 语言

'modules' => [
    // ...
    'wavecms' => [
        'class' => 'mrstroz\wavecms\Module',
        'languages' => ['en','pl']
    ],
    // ...
]
  1. 配置消息源 见文档
'components' => [
    // ...
    'i18n' => [
        'translations' => [
            '*' => [
                'class' => 'yii\i18n\DbMessageSource',
            ],
        ],
    ],
],
  1. 使用 message 命令添加模板中添加的翻译
yii message/config-template path/to/config.php
yii message path/to/config.php

共享主机

对于 共享主机,从 vendor/mrstroz/wavecms 复制并替换 environments 文件夹,然后输入 php init。前端 URL: /public,后端 URL: /public/admin

可用的 WaveCMS 模块

页面(主页、文本页面、菜单)- https://github.com/mrstroz/yii2-wavecms-page

示例(示例模块)- https://github.com/mrstroz/yii2-wavecms-example

表单(表单模块)- https://github.com/mrstroz/yii2-wavecms-form

INWAVE LOGO
INWAVE - 互联网软件开发公司
inwave.eu