yiiexttbq / blog
适用于其他应用的Yii2博客
此包的规范仓库似乎已消失,因此该包已被冻结。
1.0.191022
2019-10-22 06:30 UTC
Requires
This package is not auto-updated.
Last update: 2024-04-09 02:00:15 UTC
README
适用于其他应用的Yii2博客,特别是针对Yii2 Adminlte
安装
安装此扩展的首选方式是通过composer。
运行以下命令:
php composer.phar require --prefer-dist funson86/yii2-blog "dev-master"
或添加以下内容到您的composer.json
文件的require部分:
"funson86/yii2-blog": "*"
to the require section of your composer.json
file.
迁移
迁移运行
yii migrate --migrationPath=@funson86/blog/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' => [
'blog' => [
'class' => 'funson86\blog\Module',
'controllerNamespace' => 'funson86\blog\controllers\backend'
],
],
在前端/config/main.php中配置前端模块
'defaultRoute' => 'blog', //set blog as default route
'modules' => [
'blog' => [
'class' => 'funson86\blog\Module',
'controllerNamespace' => 'funson86\blog\controllers\frontend'
],
],
在/common/config/params.php中添加yii2-blog参数。
return [
'blogTitle' => 'HikeBlog',
'blogTitleSeo' => 'Simple Blog based on Yii2',
'blogFooter' => 'Copyright © ' . date('Y') . ' by ahuasheng on Yii2. All Rights Reserved.',
'blogPostPageCount' => '10',
'blogLinks' => [
'Google' => 'http://www.google.com',
'Funson86 Blog' => 'http://github.com/funson86/yii2-blog',
],
'blogUploadPath' => 'upload/', //default to frontend/web/upload
];