Yii2 module to implement a website.
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist daxslab/yii2-website-module "*"
or add
"daxslab/yii2-website-module": "*"
to the require section of your composer.json
file.
Website tries to be an unobstrusive CMS without limiting the capabilities of Yii2 framework as development platform. The idea is that you can add website features to an existing application, or just create a website based on Yii2 framework.
The idea behind Website module is a bit different compared with other CMS. While generally pages, posts and categories are managed, in Website everything is a page and every page can have children pages so,
The resulting tree can then have wathever depth is required.
Besides pages, Website also manages Media: any attached file that can be referenced in the resulting website. The module handles the uploading process.
Also you can manage Menus with Website module. For every menu you can create menu items and this than be pointed to any URL. When creating a menu item you either type the label and URL, or select from existing pages.
Website is meant to be used with the Yii2 Advanced Application template. Some modification could be done to make it usable with basic template.
First configure the module for all the apps in common/config/main.php
//...
'modules' => [
'website' => [
'class' => daxslab\website\Module::class,
'languages' => ['en', 'es', 'it'],
'token' => 'some-string-here'
]
]
//...
Here notice the specified attributes:
It is assumed that you are using some database and that the connection to it it's already set. Configure migrations in console/config/main.php
//...
'controllerMap' => [
'migrate' => [
'class' => 'yii\console\controllers\MigrateController',
'migrationNamespaces' => [
'daxslab\website\migrations',
]
],
],
//...
Configure controllers namespaces for the module in each app. Let's start with frontend/config/main.php
//...
'modules' => [
'website' => [
'controllerNamespace' => 'daxslab\website\controllers\frontend'
]
]
//...
And similar for backend/config/main.php
//...
'modules' => [
'website' => [
'controllerNamespace' => 'daxslab\website\controllers\backend'
]
]
//...
The module provides two sets of controllers: frontend and backend.
Comments