yeesoft / yii2-yee-core
Yee CMS 核心模块
Requires
- bower-asset/metismenu: *
- ikimea/browser: ~1.14
- omgdef/yii2-multilingual-behavior: ~2.0
- rmrevin/yii2-fontawesome: ~2.12
- yiisoft/yii2: ~2.0
- yiisoft/yii2-jui: ~2.0
This package is auto-updated.
Last update: 2022-03-29 00:33:42 UTC
README
Yee CMS 核心模块
安装
安装 yii2-app-advanced
应用程序。
更多信息: 高级应用模板安装.
- 使用 Composer 安装
If you do not have [Composer](https://getcomposer.org.cn/), follow the instructions in the
[Installing Yii](https://github.com/yiisoft/yii2/blob/master/docs/guide/start-installation.md#installing-via-composer) section of the definitive guide to install it.
With Composer installed, you can then install the application using the following commands:
```bash
cd /var/www/
composer global require "fxp/composer-asset-plugin:~1.0.0"
composer create-project --prefer-dist yiisoft/yii2-app-advanced mysite.com
```
-
初始化已安装的应用程序
执行
init
命令,并将环境选择为dev
。cd /var/www/mysite.com/ php init
-
配置您的 Web 服务器
-
对于 Apache 配置文件可能是以下内容
<VirtualHost *:80> ServerName mysite.com ServerAlias www.mysite.com DocumentRoot "/var/www/mysite.com/" <Directory "/var/www/mysite.com/"> AllowOverride All </Directory> </VirtualHost>
-
在根目录中创建
.htaccess
文件,内容如下# prevent directory listings Options -Indexes RewriteEngine on RewriteCond %{REQUEST_URI} ^/admin/$ RewriteRule ^(admin)/$ /$1 [R=301,L] RewriteCond %{REQUEST_URI} ^/admin RewriteRule ^admin(/.+)?$ /backend/web/$1 [L,PT] RewriteCond %{REQUEST_URI} ^.*$ RewriteRule ^(.*)$ /frontend/web/$1
-
在
backend/web/
和frontend/web/
文件夹中创建.htaccess
文件,内容如下RewriteEngine on # if a directory or a file exists, use the request directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward the request to index.php RewriteRule . index.php
-
-
创建一个新的数据库,并相应地调整
common/config/main-local.php
中的components['db']
配置。 -
使用控制台命令
php yii migrate
应用迁移。
#####您的 yii2-app-advanced
应用程序已安装。访问您的网站,网站应该可以正常工作,并显示消息 恭喜!您已成功创建您的 Yii 应用程序。
更新应用程序配置
-
更新
frontend/config/main.php
文件添加
'homeUrl' => '/',
和
'components' => [ 'request' => [ 'baseUrl' => '', ], ]
和
'components' => [ 'urlManager' => [ 'class' => 'yii\web\UrlManager', 'showScriptName' => false, 'enablePrettyUrl' => true, 'rules' => array( '<module:auth>/<action:\w+>' => '<module>/default/<action>', '<action:\w+>' => 'site/<action>', '<controller:\w+>/<action:\w+>' => '<controller>/<action>', ) ], ]
-
更新
backend/config/main.php
文件添加
'homeUrl' => '/admin',
和
'components' => [ 'request' => [ 'baseUrl' => '/admin', ], ]
和
'components' => [ 'urlManager' => [ 'class' => 'yii\web\UrlManager', 'showScriptName' => false, 'enablePrettyUrl' => true, 'rules' => array( '<module:\w+>/' => '<module>/default/index', '<module:\w+>/<action:\w+>/<id:\d+>' => '<module>/default/<action>', '<module:\w+>/<action:(create)>' => '<module>/default/<action>', '<module:\w+>/<controller:\w+>' => '<module>/<controller>/index', '<module:\w+>/<controller:\w+>/<action:\w+>/<id:\d+>' => '<module>/<controller>/<action>', '<module:\w+>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>', '<controller:\w+>/<id:\d+>' => '<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>', '<controller:\w+>/<action:\w+>' => '<controller>/<action>', ) ], ]
-
将
minimum-stability
设置为dev
,并在/var/www/mysite.com/composer.json
中添加"prefer-stable": true
。
安装 Yee CMS 核心模块
-
安装
yeesoft/yii2-yee-core
模块-
运行此命令
composer require --prefer-dist yeesoft/yii2-yee-core "*"
-
应用迁移
yii migrate --migrationPath=@vendor/yeesoft/yii2-yee-core/migrations/
-
从
frontend/config/main.php
和backend/config/main.php
配置中删除['components']['user']
设置。 -
在
common/config/main.php
中添加['components']['user']
和['modules']['yee']
设置。'components' => [ 'user' => [ 'class' => 'yeesoft\components\User', 'on afterLogin' => function($event) { \yeesoft\models\UserVisitLog::newVisitor($event->identity->id); } ], ]
'modules' => [ 'yee' => [ 'class' => 'yeesoft\Yee', ], ],
-
-
将
['components']['request']['cookieValidationKey']
在frontend/config/main-local.php
和backend/config/main-local.php
中的值设置为相同。这对于基于 cookie 的登录的正确工作至关重要。 -
在
common/config/main-local.php
中配置您的邮件发送器['components']['mailer']
。 -
更新后端控制器
- 将
backend/controllers/SiteController.php
的内容替换为以下内容namespace backend\controllers; use yeesoft\controllers\admin\BaseController; class SiteController extends BaseController { public function actionIndex() { return $this->render('index'); } }
- 将
#####Yee CMS 核心模块已安装!现在您可以在网站上注册。注册后,您可以在 user
表中将 superadmin
字段设置为 1
以启用用户的超级管理员权限。现在登录到网站并访问 http://yoursite.com/admin
,应该显示空的控制面板。您可以创建自己的 Yee 模块或安装现有的模块以扩展 Yee CMS 的功能。
安装 Yee CMS 模块
- 安装 Yee Auth 模块
- 安装 Yee Settings 模块
- 安装 Yee Menu 模块
- 安装 Yee User 模块
- 安装 Yee Media 模块
- 安装 Yee Post 模块
- 安装 Yee 页面模块
- 安装 评论模块
- 安装 Yee 评论模块
- 安装 Yee 的 Gii 代码生成器