PHP code example of fgh151 / yii2-view-pages

1. Go to this page and download the library: Download fgh151/yii2-view-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/ */

    

fgh151 / yii2-view-pages example snippets


    'modules' => [
        'pages' => [
            'class' => 'fgh151\vpages\Module',
        ],
        //...
    ]

Yii::getAlias('@webroot').'/catalog/index.php';

 'urlManager' => [
    'enablePrettyUrl' => true,
    'showScriptName' => false,
    'rules' => [
        '<page:\w+>' => 'pages/page/view',
    ],
],
config/web.php
[backend|frontend|common]/config/main.php
?r=pages/page/view&page=catalog/index.php
?r=pages/page/view&page=catalog/
?r=pages/page/view&page=catalog


        'modules'    => [
             'pages' => [
                 'class' => 'fgh151\vpages\Module',
                 'as access' => [
                     'class' => 'yii\filters\AccessControl',
                     'rules' => [
                         [
                             'allow' => true,
                             'roles' => ['admin'],
                         ]
                     ]
                 ]
             ]
            ...
            ...
        ],