PHP code example of infoweb-internet-solutions / yii2-cms
1. Go to this page and download the library: Download infoweb-internet-solutions/yii2-cms 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' );
infoweb-internet-solutions / yii2-cms example snippets
'controllerMap' => [
'migrate' => [
'class' => 'fishvision\migrate\controllers\MigrateController' ,
'autoDiscover' => true ,
'migrationPaths' => [
'@vendor'
],
],
],
" ...
" fishvision/yii2-migrate": " *",
" infoweb-internet-solutions/yii2-cms": " *"
]
...
"repositories" : [
{
"type" : "vcs" ,
"url" : "https://github.com/infoweb-internet-solutions/yii2-i18n-module"
},
{
"type" : "vcs" ,
"url" : "https://github.com/infoweb-internet-solutions/yii2-ckeditor"
}
]
...
...
"extra" : {
...
"asset-pattern-skip-version" : "(-patch)"
}
use \kartik \datecontrol \Module ;
return [
...
'name' => 'My Application' ,
'language' => 'nl' ,
'timeZone' => 'Europe/Brussels' ,
...
'components' => [
...
'cache' => [
'class' => 'yii\caching\DbCache' ,
],
'authManager' => [
'class' => 'yii\rbac\DbManager' ,
],
'urlManager' => [
'enablePrettyUrl' => true ,
'showScriptName' => false ,
],
'formatter' => [
'dateFormat' => 'php:d-m-Y' ,
'decimalSeparator' => ',' ,
'thousandSeparator' => ' ' ,
'currencyCode' => 'EUR' ,
],
'view' => [
'theme' => [
'pathMap' => [
'@dektrium/user/views' => '@infoweb/user/views'
],
],
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer' ,
'viewPath' => '@infoweb/cms/mail' ,
'useFileTransport' => false ,
'transport' => [
'class' => 'Swift_SmtpTransport' ,
'host' => 'host' ,
'username' => 'user' ,
'password' => 'password' ,
'port' => 'port'
],
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0 ,
'targets' => [
[
'class' => 'yii\log\FileTarget' ,
'levels' => ['error' , 'warning' ],
],
[
'class' => 'yii\log\DbTarget' ,
'levels' => ['error' ],
],
[
'class' => 'yii\log\EmailTarget' ,
'levels' => ['error' ],
'categories' => ['yii\db\*' ],
'message' => [
'from' => ['info@domain.com' ],
'to' => ['developer@domain.com' ],
'subject' => '[MySQL error @ domain.com]' ,
],
],
],
],
'i18n' => [
'class' => Zelenin\yii\modules\I18n\components\I18N::className(),
'languages' => ['nl' ]
],
],
...
'modules' => [
'datecontrol' => [
'class' => 'kartik\datecontrol\Module' ,
'displaySettings' => [
Module::FORMAT_DATE => 'php:d-m-Y' ,
Module::FORMAT_TIME => 'php:H:i' ,
Module::FORMAT_DATETIME => 'dd-MM-yyyy HH:mm:ss' ,
],
'saveSettings' => [
Module::FORMAT_DATE => 'php:U' ,
Module::FORMAT_TIME => 'php:H:i:s' ,
Module::FORMAT_DATETIME => 'php:Y-m-d H:i:s' ,
],
'displayTimezone' => 'Europe/Brussels' ,
'saveTimezone' => 'Europe/Brussels' ,
'autoWidget' => true ,
'autoWidgetSettings' => [
Module::FORMAT_DATE => ['pluginOptions' => [
'autoclose' => true ,
'todayHighlight' => true ,
]],
Module::FORMAT_DATETIME => [],
Module::FORMAT_TIME => [],
],
'convertAction' => '/cms/parse/convert-date-control'
],
'yii2images' => [
'class' => 'rico\yii2images\Module' ,
'imagesStorePath' => '@uploadsBasePath/img' ,
'imagesCachePath' => '@uploadsBasePath/img/cache' ,
'graphicsLibrary' => 'GD' ,
'placeHolderPath' => '@infoweb/cms/assets/img/transparent-placeholder.png' ,
],
],
...
'params' => [
'icon-framework' => 'fa' ,
],
];
return [
...
'name' => 'My application' ,
...
'bootstrap' => ['log' ,'cms' ],
...
'modules' => [
...
'cms' => [
'class' => 'infoweb\cms\Module' ,
],
'gridview' => [
'class' => '\kartik\grid\Module'
],
'media' => [
'class' => 'infoweb\cms\Module' ,
],
'email' => [
'class' => 'infoweb\email\Module'
],
'admin' => [
'class' => 'mdm\admin\Module' ,
],
'i18n' => [
'class' => Zelenin\yii\modules\I18n\Module::className(),
],
'settings' => [
'class' => 'infoweb\settings\Module'
],
'pages' => [
'class' => 'infoweb\pages\Module' ,
],
'partials' => [
'class' => 'infoweb\partials\Module' ,
],
'seo' => [
'class' => 'infoweb\seo\Module' ,
],
'menu' => [
'class' => 'infoweb\menu\Module' ,
],
'alias' => [
'class' => 'infoweb\alias\Module' ,
'reservedUrls' => ['page' ]
],
],
...
'components' => [
...
'view' => [
'theme' => [
'pathMap' => [
'@app/views/layouts' => '@infoweb/cms/views/layouts' ,
'@dektrium/user/views' => '@infoweb/user/views'
],
],
],
'request' => [
'class' => 'common\components\Request' ,
'web' => '/backend/web' ,
'adminUrl' => '/admin'
],
],
...
];
return [
...
'moxiemanager' => [
'license-key' => 'your-moxiemanager-key'
],
...
]
return [
...
'languages' => [
'nl' => 'Nederlands' ,
'fr' => 'Français' ,
'en' => 'English' ,
],
'companyName' => 'YourCompany'
...
];
return [
...
'components' => [
'user' => [
'identityClass' => 'infoweb\user\models\frontend\User' ,
'enableAutoLogin' => true ,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0 ,
'targets' => [
[
'class' => 'yii\log\FileTarget' ,
'levels' => ['error' , 'warning' ],
],
],
],
'errorHandler' => [
'errorAction' => 'site/error' ,
],
'request' =>[
'class' => 'common\components\Request' ,
'web' => '/frontend/web' ,
'csrfParam' => '_frontendCSRF' ,
],
'urlManager' => [
'class' => 'codemix\localeurls\UrlManager' ,
'enablePrettyUrl' => true ,
'showScriptName' => false ,
'rules' => [
'404' => 'site/error' ,
'<alias:[\d\w\-]+>' => 'site/index' ,
],
],
'page' => [
'class' => 'infoweb\pages\components\Page'
]
],
...
];
...
Yii::setAlias('baseUrl' , 'http://' . ((isset ($_SERVER['HTTP_HOST' ])) ? $_SERVER['HTTP_HOST' ] : '' ) . ((YII_ENV_DEV) ? '/directory-in-your-localhost' : '' )); <-- Change your path
Yii::setAlias('basePath' , dirname(dirname(__DIR__ )));
Yii::setAlias('uploadsBaseUrl' , Yii::getAlias('@baseUrl' ) . '/frontend/web/uploads' );
Yii::setAlias('uploadsBasePath' , Yii::getAlias('@basePath' ) . '/frontend/web/uploads' );
Yii::setAlias('frontendUrl' , Yii::getAlias('@baseUrl' ) . '/frontend/web' );
...
'controllerMap' => [
'migrate' => [
'class' => 'fishvision\migrate\controllers\MigrateController' ,
'autoDiscover' => true ,
'migrationPaths' => [
'@vendor'
],
],
],
namespace common \components ;
class Request extends \yii \web \Request
{
public $web;
public $adminUrl;
public function getBaseUrl ()
{
return str_replace($this ->web, '' , parent ::getBaseUrl()) . $this ->adminUrl;
}
public function resolvePathInfo ()
{
if ($this ->getUrl() === $this ->adminUrl) {
return '' ;
} else {
return parent ::resolvePathInfo();
}
}
}
'modules' => [
'user' => [
'class' => 'dektrium\user\Module' ,
'modelMap' => [
'User' => 'infoweb\user\models\User' ,
],
],
],
bash
php composer.phar global ject --prefer-dist --stability=dev yiisoft/yii2-app-advanced advanced
README.md
LICENSE.md