wdmg/yii2-pages

Manage static application pages

Installs: 5

Dependents: 1

Suggesters: 0

Stars: 2

Watchers: 3

Forks: 2

Open Issues: 0

Type:yii2-extension

1.1.3 2019-08-06 12:39 UTC

README

Yii2 Github all releases Progress GitHub license GitHub release

Yii2 Pages

Static pages manager

Requirements

Installation

To install the module, run the following command in the console:

$ composer require "wdmg/yii2-pages"

After configure db connection, run the following command in the console:

$ php yii pages/init

And select the operation you want to perform:

  1. Apply all module migrations
  2. Revert all module migrations

Migrations

In any case, you can execute the migration and create the initial data, run the following command in the console:

$ php yii migrate --migrationPath=@vendor/wdmg/yii2-pages/migrations

Configure

To add a module to the project, add the following data in your configuration file:

'modules' => [
    ...
    'pages' => [
        'class' => 'wdmg\pages\Module',
        'routePrefix' => 'admin',
        'pagesRoute'  => '/pages', // route for frontend (string or array), use "/" - for root
        'pagesLayout' => '@app/views/layouts/main' // path to default layout for render in frontend
    ],
    ...
],

Routing

Use the Module::dashboardNavItems() method of the module to generate a navigation items list for NavBar, like this:

<?php
    echo Nav::widget([
    'options' => ['class' => 'navbar-nav navbar-right'],
        'label' => 'Modules',
        'items' => [
            Yii::$app->getModule('pages')->dashboardNavItems(),
            ...
        ]
    ]);
?>

Status and version [in progress development]

  • v.1.1.3 - Minor bug fixies
  • v.1.1.2 - Bugfix in composer.json, controllers and view
  • v.1.1.1 - Added support of redirects, fixing route detection and added sluggable behavior for aliases