How To Use Theme




'theme' => array(

			'class' => 'yii\base\Theme',

			'basePath'=>"Application::basePath",

		//	'pathMap'=>array("basePath" => "basePath"),

		),

//\Yii::$app->theme->pathMap = "sdfsd";exit;



i want to set theme…

thank you

(Note to forum administrators: it seems that it is time to create a “General Discussion for Yii 2.x” subforum :) )

let’s talk about Yii 2.x :rolleyes:

Let’s keep using this forum for discussions about 2.0. We don’t want to bring illusion that Yii 2.0 is formally released.

To use a theme, you need to configure the "view" application component like following:




'view' => array(

    'theme' => array(

        'pathMap' => array('@app/views' => '@wwwroot/themes/basic'),

        'baseUrl' => '@www/themes/basic',

    ),

),



thank you

I used @www and @wwwroot and it did not work for me. But instead @web and @webroot worked fine.

Thnx

We are developing a new application using Yii2. We have different themes for users. Say "Winter" theme, "Christmas" theme etc.

How to register CSS and JS for each of these themes in Yii2.

Please help.

Via bundles in your layout that is custom for each theme.

thank you

Hello,

I try to add configuration like below in main-local.php but it’s still refer to the original,

I use advance template that i download from Yii Website.

I putted my themes file under /frontend/web/themes/metronic

Any advice




'view' => [

            'theme' => [

                'pathMap' => ['@app/frontend/views' => '@wwwroot/frontend/web/themes/metronic'],

                'baseUrl' => '@web/frontend/web/themes/metronic',

            ],

        ],



My config: https://github.com/letyii/cms/blob/master/config/backend.php




        'view' => [

            'theme' => [

                'pathMap' => [

                    '@app/views' => '@app/themes/letyii/views',

                    '@app/modules' => '@app/themes/letyii/modules',

                    '@app/widgets' => '@app/themes/letyii/widgets',

                ],

                'basePath' => '@app/themes/letyii',

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

            ],

        ],