vlad-planet/yii2-blog

yii2 的用户博客

安装: 9

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 0

分支: 0

开放问题: 0

语言:JavaScript

类型:yii2-extension

dev-master 2019-02-23 03:35 UTC

This package is not auto-updated.

Last update: 2024-09-30 05:53:58 UTC


README

yii2 的用户博客

安装

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

运行以下命令之一:

php composer.phar require --prefer-dist vlad-planet/yii2-blog "*"

"vlad-planet/yii2-blog": "*"

将以下内容添加到您的 composer.json 文件的 require 部分中。

!!! 配置

common\config\main.php

'modules' => [
	'blog' => [
	'class' => vladplanet\blog\Module::class,
	'urlManager' => 'urlManager',// 'urlManager' by default, or maybe you can use own component urlManagerFrontend
	'imgFilePath' => '@frontend/web/img/blog/',
	'imgFileUrl' => '/img/blog/',
	'userModel' => \common\models\User::class,
	'userPK' => 'id', //default primary key for {{%user}} table
	'userName' => 'username', //uses in view (may be field `username` or `email` or `login`)
],

frontend\config\main.php

'modules' => [
	'blog' => [
	'class' => 'vladplanet\blog\Module',
	'controllerNamespace' => 'vladplanet\blog\controllers\frontend',
	'blogPostPageCount' => 6,
	'blogCommentPageCount' => 10, //20 by default
	'enableComments' => true, //false by default
	'schemaOrg' => [ // empty array [] by default! 
	'publisher' => [
		'logo' => '/img/logo.png',
		'logoWidth' => 191,
		'logoHeight' => 74,
		'name' => 'My Company',
		'phone' => '+1 800 488 80 85',
		'address' => 'City, street, house'
            ]
        ]
    ],

'bootstrap' => [
	'log',
	'vladplanet\blog\Bootstrap',
],

backend\config\main.php

'bootstrap' => [
	'log',
	'vladplanet\blog\Bootstrap',
],
	
'modules' => [
	'blog' => [
		'class' => 'vladplanet\blog\Module',
		'controllerNamespace' => 'vladplanet\blog\controllers\backend',
		//'adminAccessControl' => 'common\components\AdminAccessControl', // null - by default 
	],
],

url

http://yii2.local/blog http://yii2.local/admin/blog

用法

扩展安装完成后,只需在代码中通过以下方式使用它:

<?= \vladplanet\blog\AutoloadExample::widget(); ?>```