Skip to content

patipark/yii2-cms

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMS Extension

Base content management system for Yii Framework 2.0

Latest Stable Version Total Downloads License 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.

CONFIGURATION

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

php yii migrate --migrationPath=@vendor/yii2mod/yii2-cms/migrations

NOTE: comments extension used in 1.0.5 release and above, if you are using a previous version of this extension, you don't need to install comments extension.

  1. To use this extension first you need to configure the comments extension, after that 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/',
            ],
        ],
    ],

You can then access to management section through the following URL:

http://localhost/path/to/index.php?r=admin/cms/index

  1. Add new Rule class to the urlManager array in your application configuration by the following code:
 'components' => [
        'urlManager' => [
            'rules' => [
                ['class' => 'yii2mod\cms\components\PageUrlRule'],
            ]
        ],
    ],
  1. 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'
            ],
        ];
    }

And now you can create your own pages via the admin panel, and access them via the url of each page.

Additional features:

  1. You can insert your own widget on the page by the following steps:

    • Create the widget and add the static function. For example:
      public static function insertList() {
          return self::widget([
              //your params
          ]);
      }
    • When you create the page via admin panel add the following code to the content:

         \app\widgets\MyWidget:list() // call the function insertList placed in MyWidget class
      

About

Simple CMS extension

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%