Как настроить Yii2 с темой AdminLTE [закрыто]



Я новичок в Yii2 Framework и только что настроил приложение Yii2 Advance.



Теперь я хочу настроить adminLTE тему в моем приложении Yii2 Advance без использования композитора. Каким-то образом Composer не устанавливается на мою машину.



Ref: http://www.yiiframework.com/wiki/729/tutorial-about-how-to-integrate-yii2-with-fantastic-theme-adminlte/

931   2  

2 ответов:

1) Перейти к https://github.com/almasaeed2010/AdminLTE/releases и загрузить последнюю версию.

2) создайте папку bower в vendor пути. И в bower снова создайте новую папку admin-lte.

3) извлеките архив из первого шага в /vendor/bower/admin-lte.

4) измените свой AppAsset (это расположение в папке backend/assets) и добавьте этот код:

class AppAsset extends AssetBundle
{
    public $sourcePath = '@bower/';
    public $css = ['admin-lte/dist/css/AdminLTE.css'];
    public $js = ['admin-lte/dist/js/AdminLTE/app.js'];
    public $depends = [
        'yii\web\YiiAsset',
        'yii\bootstrap\BootstrapAsset',
        'yii\bootstrap\BootstrapPluginAsset',
    ];
}

Embedding admin lte theme i Yii2 basic

1) создать проект yii с помощью composer

Sudo du компакт-диск в /var/www в/HTML-код композитор создать-проект зависимостей коде с Yii2-приложения-основной базовый 2.0.4

2) Теперь создайте его доступным

Название проекта Chmod 777-R

3) загрузите тему admin lte с помощью

Клон Git https://github.com/bmsrox/baseapp-yii2basic-adminlte.git

Скопируйте и пропустите все файлы в основную корневую папку

4) Теперь обновить композитор

Обновление композитора

Если ошибка токена, то создайте учетную запись в git и создайте токен на вкладке Настройки, нажав genarate new token

Скопируйте и предоставьте его композитору

5) обновите свой веб-сайт.php файл в конфигурации
<?php

$params = require(__DIR__ . '/params.php');

$config = [
    'id' => 'basic',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'layout'=>'column2',
    'layoutPath'=>'@app/themes/adminLTE/layouts',
    'components' => [

     'urlManager' => [
            'class' => 'yii\web\UrlManager',
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
                ''=>'site/index',
                '<action:(index|login|logout)>'=>'site/<action>',
                '<controller:\w+>/<id:\d+>' => '<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
                '<controller:\w+>/<action:\w+>' => '<controller>/<action>'
            ],
        ],

         'view' => [
            'theme' => [
                'pathMap' => ['@app/views' => '@app/themes/adminLTE'],
                'baseUrl' => '@web/../themes/adminLTE',
            ],
        ],

        'request' => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => 'n0VkMX1RmIa_ovJmwR3Gn_hdZyQ7SyKe',
        ],
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        'user' => [
            'identityClass' => 'app\models\User',
            'enableAutoLogin' => true,
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
            'useFileTransport' => true,
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'db' => require(__DIR__ . '/db.php'),
    ],
    'params' => $params,
];

if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = 'yii\debug\Module';

    $config['bootstrap'][] = 'gii';
    //$config['modules']['gii'] = 'yii\gii\Module';
    $config['modules']['gii'] = [
            'class' => 'yii\gii\Module',
            'generators' => [ //here
                'crud' => [ // generator name
                    'class' => 'yii\gii\generators\crud\Generator', // generator class
                    'templates' => [ //setting for out templates
                        'custom' => '@vendor/bmsrox/yii-adminlte-crud-template', // template name => path to template
                    ]
                ]
            ],
        ];
}

return $config;

6) классе sitecontroller обновление. Php в папке контроллера

Замените actionLogout следующим кодом

public function actionLogout()
    {
        Yii::$app->user->logout();

        return $this->redirect(Yii::$app->user->loginUrl);
    }

    public function beforeAction($action)
    {
        if (parent::beforeAction($action)) {
            // change layout for error action
            if ($action->id=='login')
                 $this->layout = 'login';
            return true;
        } else {
            return false;
        }
    }

7) Если ошибка неправильной конфигурации, то

Обновление apche2

С помощью команды

A2enmod переписать

И restrart apache с использованием

Перезапуск службы apache2

Закончено...........

Удачи

Comments

    Ничего не найдено.