yiimodules / yii2-categories
此包已被废弃,不再维护。未建议替代包。
完整的分类管理系统
1.0.1
2016-03-13 12:45 UTC
Requires
- php: >=5.3.2
- yiidoc/yii2-redactor: *
- yiisoft/yii2: *
- yiisoft/yii2-imagine: ~2.0.0
This package is not auto-updated.
Last update: 2018-08-30 06:27:43 UTC
README
#分类管理Yii2模块为基于Yii2的Web应用提供的完整分类管理模块,易于集成
- 易于安装
- 创建无限级的多级分类
- 分类树结构可视化分类深度
- 分类图片
- 分类SEO元数据(标题、关键词、描述)
1. 下载
可以使用composer安装Yii2-categories。运行以下命令下载并安装Yii2-categories
composer require "yiimodules/yii2-categories:1.0.*"
2. 配置
将以下行添加到您的配置文件中,以便通过Web URL访问此模块
注意:除了分类模块外,您还需要配置redactor模块,该模块作为分类模块的依赖项安装,如下所示,以便在分类描述中添加wysiwyg编辑器。
'modules' => [ 'redactor' => 'yii\redactor\RedactorModule', 'categories' => [ 'class' => 'yiimodules\categories\Module', ], ],
3. 更新数据库模式
您需要做的最后一件事是通过应用迁移来更新您的数据库模式。确保您已正确配置db应用程序组件,并运行以下命令
$ php yii migrate/up --migrationPath=@vendor/yiimodules/yii2-categories/migrations
运行模块?
$ https:///YOUR-PROJECT-NAME/web/index.php?r=categories
在前端获取分类列表
// To list all the categories & sub categories in array response Yii::$app->getModule('categories')->getAll(); // To list specific category with sub categories in array response, here 4 is category Id I'm fetching. Yii::$app->getModule('categories')->getOne(4);