pantera-digital/yii2-content-kit

该包最新版本(dev-master)没有可用的许可证信息。

安装: 548

依赖项: 0

建议者: 0

安全: 0

星级: 1

观察者: 4

分支: 1

开放问题: 0

类型:yii2-extension

dev-master 2020-12-27 06:31 UTC

This package is auto-updated.

Last update: 2024-09-27 14:49:37 UTC


README

网站内容管理模块:页面、区块、菜单

该模块依赖于 pantera-digital/yii2-mediapantera-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() ?>

参数

区块

<?= \pantera\content\widgets\block\Block::widget([
    'position' => 'left',
]) ?>

参数

  • $position - 位置
  • $ids - 标识符或标识符集合
  • $activatedByUrl - 标志,指示是否需要根据 URL 进行激活检查
  • $layout - 包裹在区块上的模板