Yii2 Theme Integration

Hi,

I have installed yii2 advanced application,and now I want to change backend theme.

How I can do this?

Is there any file where I need to tell yii2 that use my custom theme?

http://www.yiiframework.com/doc-2.0/guide-output-theming.html

I just replaced this code in advanced\backend\config\main.php,but nothing happened!

‘view’ => [

		        'theme' => [


		           'pathMap' => ['@app/views' => '@app/themes/adminlte'],


       			   'baseUrl' => '@web/themes/adminlte',


		        ],


	],

Do you have that folder full with views?

Yes I have folder views in themes/adminlte/views.

But its giving me a error:

The view file does not exist: /home/public_html/yii2/advanced/backend/views/site/login.php

You should have them in themes/adminlte instead - that’s what you mapped to. Besides, themes are views already - no need to specify the subfolder with such name (common sense).

i think u have to check permissions for that if u using linux environment.

post the current part of the View component in the config file

just keep ur theme inside web folder in backend ,if u r using backend or frontend.then just link then in backend/assests or frontend/assets in appassets folders like below

class AppAsset extends AssetBundle

{

public $basePath = '@webroot';


public $baseUrl = '@web';


public $css = [


      'themes/default/assets/css/font-awesome.min.css',


      'themes/default/assets/css/theme-fonts.css',


   	  'themes/default/assets/css/theme.min.css',


      'themes/default/assets/css/theme-skins.min.css',


      'themes/default/assets/css/theme-part2.min.css',


      'themes/default/assets/css/theme-rtl.min.css',


      'themes/default/assets/css/theme.onpage-help.css',


      'css/custom.css' 


       ];


public $js = [


         'themes/default/assets/js/theme.min.js',


        'themes/default/assets/js/theme-extra.min.js',


        'themes/default/assets/js/theme-elements.min.js',


        


       ];


public $depends = [


     'yii\web\YiiAsset',


     'yii\bootstrap\BootstrapAsset',


];

}

it will pass ur all view through this file so they will take ur themes css nd js

if you are using backend then it will pass through backend/assets/appassets,

if you want your theme in backend as well as in frontend the override appasset cleass in common folder for both backend and frontend,otherwise you can keep diffrent themes for backend and for backend


	 

    	 'view' => [

				'theme' => [

					'pathMap' => ['@app/views' => '@app/themes/adminlte'],

					'baseUrl' => '@web/themes/adminlte',

				],

			], 

    	 

You have used @app but if my memory serves me correct that is for basic app. Change to @frontend or @backend accordingly

This link may help someone.