PHP code example of pavlinter / yii2-adm-pages

1. Go to this page and download the library: Download pavlinter/yii2-adm-pages library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pavlinter / yii2-adm-pages example snippets


'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