funson86 / yii2-cms
适用于其他应用的Yii2 Cms
2.0.1
2015-01-31 02:46 UTC
Requires
This package is not auto-updated.
Last update: 2024-09-24 03:49:18 UTC
README
为其他应用提供Yii2 Cms,特别是为Yii2 Adminlte
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一
php composer.phar require --prefer-dist funson86/yii2-cms "*"
或将以下内容添加到您的 composer.json
文件的require部分。
"funson86/yii2-cms": "*"
使用方法
扩展安装后,您可以通过以下方式在代码中使用它
迁移
运行迁移
php yii migrate --migrationPath=@funson86/cms/migrations
在/common/config/main.php中配置URL重写
'timeZone' => 'Asia/Shanghai', //time zone affect the formatter datetime format 'components' => [ 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ '<controller:\w+>/<id:\d+>' => '<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>', '<controller:\w+>/<action:\w+>' => '<controller>/<action>', ], ], 'formatter' => [ //for the showing of date datetime 'dateFormat' => 'yyyy-MM-dd', 'datetimeFormat' => 'yyyy-MM-dd HH:mm:ss', 'decimalSeparator' => ',', 'thousandSeparator' => ' ', 'currencyCode' => 'CNY', ], ],
在backend/config/main.php中配置后端模块
'modules' => [ 'cms' => [ 'class' => 'funson86\cms\Module', 'controllerNamespace' => 'funson86\cms\controllers\backend' ], ],
在前端/config/main.php中配置前端模块
'defaultRoute' => 'cms', //set cms as default route 'modules' => [ 'cms' => [ 'class' => 'funson86\cms\Module', 'controllerNamespace' => 'funson86\cms\controllers\frontend' ], ],
在/frontend/config/params.php中添加yii2-cms参数。
return [ 'cmsTitle' => 'HikeCms', 'cmsTitleSeo' => 'Simple Cms based on Yii2', 'cmsFooter' => 'Copyright © ' . date('Y') . ' by ahuasheng on Yii2. All Rights Reserved.', 'cmsPostPageCount' => '2', 'cmsLinks' => [ 'Google' => 'http://www.google.com', 'Funson86 Cms' => 'http://github.com/funson86/yii2-cms', ], ];