Tutorial about How to Integrate Yii2 with fantastic theme AdminLTE

You are viewing revision #4 of this wiki article.
This version may not be up to date with the latest version.
You may want to view the differences to the latest version or see the changes made in this revision.

« previous (#3)next (#6) »

Yii2 comes with a charming twitter bootstrap version 3. But if it is less, then you can integrate with web templates that you like. One example is wonderfull template "adminLTE" http://almsaeedstudio.com/AdminLTE/

With Yii2 we can do it easily, the following steps

  1. Download adminLTE of http://almsaeedstudio.com/AdminLTE/
  2. extract to a directory, @ app \ web \
  3. Change the folder name becomes "adminlte"
  4. Change AppAsset.php located in the directory @ app \ assets \
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace backend\assets;

use yii\web\AssetBundle;

/**
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class AppAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';
    public $css = [
    	'css/site.css',
    	'adminlte/css/AdminLTE.css', // THIS CHANGE
    	];
    public $js = [
    	'adminlte/js/AdminLTE/app.js' // THIS CHANGE
    	];
    public $depends = [
        'yii\web\YiiAsset',
        'yii\bootstrap\BootstrapAsset',
    ];
}
  1. Finish Now look at the results :)