pavlinter/yii2-adm-pages

Yii2: Adm-Pages

Installs: 200

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

v1.0.4 2015-09-15 12:10 UTC

This package is not auto-updated.

Last update: 2024-11-09 17:09:05 UTC


README

Установка

Удобнее всего установить это расширение через composer.

   "pavlinter/yii2-adm-pages": "*",

Настройка

'modules' => [
    ...
    'adm' => [
        ...
        'modules' => [
            'admpages'
        ],
        ...
    ],
    'admpages' => [
        'class' => 'pavlinter\admpages\Module',
        'pageLayouts' => [
           'page' => 'Page',
           'page-image' => 'Page + image',
        ],
        'pageRedirect' => [],
        'pageTypes' => [],
        'pageLayout' => '/main',
        'closeDeletePage' => [] //id [2,130]
    ],
    ...
],
'components' => [
    ...
    'urlManager' => [
        ....
        'rules'=>[
            '' => 'admpages/default/main', //OR $config['defaultRoute'] = 'admpages/default/main';
            'page/<alias:([A-Za-z0-9_-])+>' => 'admpages/default/index',
        ],
    ],
    ...
],

Запустить миграцию

yii migrate --migrationPath=@vendor/pavlinter/yii2-adm-pages/admpages/migrations

Как использовать

echo Html::a('My-Page',['/admpages/default/index', 'alias' => 'My-Page']);

echo Page::urlToLayout('contact'); //Возращяет ссылку на страницу, где layout contact