pantera-digital / yii2-content-kit
该包最新版本(dev-master)没有可用的许可证信息。
dev-master
2020-12-27 06:31 UTC
Requires
- php: >=7.0.0
- 2amigos/yii2-ckeditor-widget: ~2.1
- alexandernst/yii2-device-detect: *
- bower-asset/owl.carousel: *
- bower-asset/sweetalert2: *
- kartik-v/yii2-widgets: *
- mihaildev/yii2-elfinder: *
- yiisoft/yii2: ~2.0.6
This package is auto-updated.
Last update: 2024-09-27 14:49:37 UTC
README
网站内容管理模块:页面、区块、菜单
该模块依赖于 pantera-digital/yii2-media
和 pantera-digital/yii2-seo
,更多详情请查看这里
https://github.com/pantera-digital/yii2-media
https://github.com/pantera-digital/yii2-seo
安装模块
安装和配置模块 https://github.com/MihailDev/yii2-elfinder
安装和配置模块 https://packagist.org.cn/packages/alexandernst/yii2-device-detect
执行 composer 命令
composer require pantera-digital/yii2-content-kit
或者在 composer.json 中添加
"pantera-digital/yii2-content-kit": "@dev"
并执行命令
composer update
运行迁移
php yii migrate --migrationPath=vendor/pantera-digital/yii2-content-kit/migrations
或者添加到控制台配置中
'controllerMap' => [
'migrate' => [
'class' => yii\console\controllers\MigrateController::className(),
'migrationPath' => [
'@pantera/content/migrations',
],
],
],
并执行
php yii migrate
配置 Media 模块
https://github.com/pantera-digital/yii2-media - 这里是配置说明
配置前端和后端模块
添加到前端应用程序配置
'content' => [
'class' => \pantera\content\Module::class,
],
添加到后端应用程序配置
'content' => [
'class' => \pantera\content\admin\Module::class,
'permissions' => ['admin'],
'useBlock' => true, // по умолчанию true
'useSlider' => true, // по умолчанию true
'useMedia' => true, // по умолчанию true
'useSeo' => true, // по умолчанию true
],
前端应用程序配置
在应用程序规则中添加 UrlManager
'urlManager' => [
'rules' => [
[
'class' => pantera\content\components\UrlManager::class,
],
],
],
覆盖页面视图
在应用程序配置中添加
'components' => [
'view' => [
'class' => 'yii\web\View',
'theme' => [
'pathMap' => [
'@pantera/content/views/view' => '@frontend/views/content/view',
],
],
],
],
新文件应命名为 index--id-{id}、index--{slug} 或 index--type-{type}
- -id 记录的标识符
- -slug 记录的当前别名
- -type 类型键
小部件
幻灯片
<?= pantera\content\widgets\slider\Slider::widget() ?>
参数
- $pluginOptions - 配置幻灯片插件 https://owlcarousel2.github.io/OwlCarousel2/docs/api-options.html
- $options - 容器参数数组
区块
<?= \pantera\content\widgets\block\Block::widget([
'position' => 'left',
]) ?>
参数
- $position - 位置
- $ids - 标识符或标识符集合
- $activatedByUrl - 标志,指示是否需要根据 URL 进行激活检查
- $layout - 包裹在区块上的模板