Yii2 Blog for other application, especially for Yii2 Adminlte
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist funson86/yii2-blog "dev-master"
or add
"funson86/yii2-blog": "*"
to the require section of your composer.json
file.
Migration run
yii migrate --migrationPath=@funson86/blog/migrations
'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',
],
],
'modules' => [
'blog' => [
'class' => 'funson86\blog\Module',
'controllerNamespace' => 'funson86\blog\controllers\backend'
],
],
'defaultRoute' => 'blog', //set blog as default route
'modules' => [
'blog' => [
'class' => 'funson86\blog\Module',
'controllerNamespace' => 'funson86\blog\controllers\frontend'
],
],
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
];
- backend : http://you-domain/backend/web/blog
- frontend : http://you-domain/fontend/web/blog