asinfotrack / yii2-article
Yii2-article是一个提供基本CMS功能的模块
1.0.2
2021-08-13 07:44 UTC
Requires
- php: >=7.1.0
- asinfotrack/yii2-toolbox: ~1.0.0
- creocoder/yii2-nested-sets: ~0.9.0
- yiisoft/yii2: ~2.0.6
- yiisoft/yii2-bootstrap: ~2.0.0
- yiisoft/yii2-jui: ~2.0.0
- dev-master
- 1.0.2
- 1.0.1
- 1.0.0
- 0.8.20
- 0.8.19
- 0.8.18
- 0.8.17
- 0.8.16
- 0.8.15
- 0.8.14
- 0.8.13
- 0.8.12
- 0.8.11
- 0.8.10
- 0.8.9
- 0.8.8
- 0.8.7
- 0.8.6
- 0.8.5
- 0.8.4
- 0.8.3
- 0.8.2
- 0.8.1
- 0.8.0
- dev-dependabot/npm_and_yarn/debug-and-grunt-contrib-watch-3.2.7
- dev-dependabot/npm_and_yarn/qs-and-grunt-contrib-watch-6.11.0
- dev-dependabot/npm_and_yarn/minimatch-and-grunt-and-grunt-contrib-watch-3.0.8
- dev-dependabot/npm_and_yarn/grunt-1.5.3
- dev-dependabot/composer/yiisoft/yii2-2.0.38
- dev-feature/menu
This package is auto-updated.
Last update: 2024-09-11 01:41:39 UTC
README
Yii2-article是一个轻量级的CMS扩展
安装
基本安装
安装此扩展的最佳方式是通过composer。
运行以下命令:
$ composer require asinfotrack/yii2-article
或者将以下内容添加到你的composer.json
文件的require
部分:
"asinfotrack/yii2-article": "~1.0.1"
to the require section of your composer.json file.
迁移
下载后,您需要应用迁移以创建所需的表
yii migrate --migrationPath=@vendor/asinfotrack/yii2-article/migrations
要删除表,只需向下执行相同的迁移即可。
将模块添加到yii-config
'modules'=>[ //your other modules... 'article'=>[ 'class'=>'asinfotrack\yii2\article\Module', 'userRelationCallback'=>function ($model, $attribute) { return $model->hasOne('app\models\User', ['id'=>$attribute]); }, 'backendArticleAccessControl' = [ 'class'=>'yii\filters\AccessControl', 'rules'=>[ ['allow'=>true, 'roles'=>['@']], ], ], 'backendArticleCategoryAccessControl' = [ 'class'=>'yii\filters\AccessControl', 'rules'=>[ ['allow'=>true, 'roles'=>['@']], ], ], 'components'=>[ //configuration of the renderer 'renderer'=>[ 'class'=>'asinfotrack\yii2\article\components\ArticleRenderer', 'addDataAttributesToArticleTagOptions'=>true, 'showDebugTags'=>false, 'placeholderCallbackMap'=>[ //example for a custom placeholder for an image tag 'img'=>function ($params) { return Html::img($params[0]); }, //your other custom placeholder tags here... ], ], ], ], ],
有关选项的完整列表,请参阅模块内类的属性。特别是检查类asinfotrack\yii2\article\Module
和asinfotrack\yii2\article\components\ArticleRenderer
。下面提供了一些示例。
启动模块
此步骤是可选的,并且仅当您想在模块外部的控制器中使用ArticleAction
时才必要。
将模块添加到yii-config的bootstrap-array中,以确保当第三方控制器访问ArticleRender
时它被加载。确保您使用与上面步骤中相同的模块-ID。
'bootstrap'=>['log', 'article'],