set a theme


i am using yii2.0

how can i set a theme as per controller means if i am using sitecontroller then theme is site if using adminn them theme is admin how can i set please help

Create a class for each assetBundle then in your controller do:

public function init()





thanks for your advice can you please give me an example of code?

so i can easily do that

If you have installed the Yii2 basic app, you already have one AssetBundle in assets/AppAsset.php

To add another AssetBundle, create another class in the assets folder that extends AssetBundle eg,

namespace app\assets;

use yii\web\AssetBundle;

class AppAssetAlternative extends AssetBundle


    public $basePath = '@webroot';

    public $baseUrl = '@web';

    public $css = [



    public $js = [



    public $depends = [





Then under your web folder create a new folder called alt with sub folders js and css.