Skip to content

yii2ApplicationCollect/yii2-cms

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMS Extension

  • Scrutinizer Code Quality
  • Build Status

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yii2mod/yii2-cms "*"

or add

"yii2mod/yii2-cms": "*"

to the require section of your composer.json.

Usage

If you use this extension separate from the base template, then you need execute cms init migration by the following command:

php yii migrate/up --migrationPath=@yii2mod/cms/migrations

To use this extension, you have to configure the main config in your application:

'modules' => [
        'admin' => [
            'controllerMap' => [
                'cms' => 'yii2mod\cms\controllers\CmsController'
                // You can set your template files
                // 'layout' => '@app/modules/backend/views/layouts/main',
                // 'viewPath' => '@app/modules/backend/views/cms/',
            ],
        ],
    ],
 'components' => [
        'urlManager' => [
            'rules' => [
                ['class' => 'yii2mod\cms\components\PageUrlRule'],
            ]
        ],
    ],

Add to SiteController (or configure via $route param in urlManager):

    /**
     * @return array
     */
    public function actions()
    {
        return [
            'page' => [
                'class' => 'yii2mod\cms\actions\PageAction',
                // You can set your template files
                'view' => '@app/views/site/page'
            ],
        ];
    }

Packages

No packages published

Languages

  • PHP 100.0%