black-lamp / yii2-articles

此包的最新版本(0.8.2)没有提供许可证信息。

Yii框架的文章扩展

安装: 520

依赖: 2

建议者: 0

安全: 0

星标: 1

关注者: 6

分支: 3

开放问题: 1

类型:yii2-extension

0.8.2 2020-04-15 08:01 UTC

README

安装

Composer 需求部分

"black-lamp/yii2-articles": "0.*"

迁移

php yii migrate --migrationPath=@yii/rbac/migrations
php yii migrate --migrationPath=@vendor/black-lamp/yii2-multi-lang/migration
php yii migrate --migrationPath=@vendor/black-lamp/yii2-articles/common/migrations
php yii migrate --migrationPath=@vendor/black-lamp/yii2-seo/migrations

将文章模块添加到您的后端配置

    'modules' => [
    	...
        'articles' => [
            'class' => 'bl\articles\backend\Module'
        ],
        ...
    ]

将文章模块添加到您的前端配置

    'modules' => [
    	...
        'articles' => [
            'class' => 'bl\articles\frontend\Module'
        ],
        ...
    ]

配置 seo-url 规则

	'urlManager' => [
		...
		'rules' => [
			...
			[
			    'class' => 'bl\articles\UrlRule'
			]
		]
	]

配置 Imagable 模块

    'components' => [
        ...
        'articles_imagable' => [
            'class' => bl\imagable\Imagable::className(),
            'imageClass' => CreateImageImagine::className(),
            'nameClass' => bl\imagable\name\CRC32Name::className(),
            'imagesPath' => '@frontend/web/images',
            'categories' => [
                'origin' => false,
                'category' => [
                    'thumbnail' => [
                        'origin' => false,
                        'size' => [
                            'big' => [
                                'width' => 1500,
                                'height' => 500
                            ],
                            'thumb' => [
                                'width' => 500,
                                'height' => 500,
                            ],
                            'small' => [
                                'width' => 150,
                                'height' => 150
                            ]
                        ]
                    ],
                    'menu_item' => [
                        'origin' => false,
                        'size' => [
                            'big' => [
                                'width' => 1500,
                                'height' => 500
                            ],
                            'thumb' => [
                                'width' => 500,
                                'height' => 500,
                            ],
                            'small' => [
                                'width' => 150,
                                'height' => 150
                            ]
                        ]
                    ],
                    'social' => [
                        'origin' => true,
                        'size' => [
                            'big' => [
                                'width' => 1500,
                                'height' => 500
                            ],
                            'thumb' => [
                                'width' => 500,
                                'height' => 500,
                            ],
                            'small' => [
                                'width' => 150,
                                'height' => 150
                            ]
                        ]
                    ],
                ]
            ]
        ],
    ]

使用

yourbackend.url/articles/article

**YOU MUST CONFIGURE IMAGABLE COMPONENT**

角色及其权限

articleManager

  • viewArticleList
  • editArticles
  • deleteArticles

articleCategoryManager

  • viewCategoryList
  • editCategories
  • deleteCategories

articleAdministrator 扩展了分类和文章管理员的权限。