Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii2 Theme Integration not working?

Tags:

yii2

Yii2 Theme Integration ?

'view' => [
    'theme' => [
        'pathMap' => ['@app/views' => '@app/admin/views'],
        'baseUrl' => '@web/admin',
    ],
],
like image 539
Deepak Syal Avatar asked Sep 27 '15 16:09

Deepak Syal


2 Answers

Hope you are using the advanced template

add a folder themes in the backend folder

make a subfolder with the theme name and make sure you have the layouts folder in that folder

ie your new layout folder path will be

backend/themes/themefoldername/layouts

in the folder backend/config/main.php

 'components' => [

        'view' => [
            'theme' => [
                'basePath' => '@backend/themes/themefoldername',
                'baseUrl' => '@backend/themes/themefoldername',
                'pathMap' => [
                    '@backend/views' => '@backend/themes/themefoldername',
                ],
            ],
        ],...

if you want to keep it in the web folder also you can do that,but make sure you change the path accordingly

like image 195
Midhun Avatar answered Sep 28 '22 19:09

Midhun


In advance template there is separate configuration for frontend and backend theme integration.

Frontend theme integration => "frontend/config/main.php" file :

'components' => [ 
    'view' => [
            'theme' => [

                'pathMap' => [
                    '@frontend/views' => '@themes/frontend/views', // need to // set alias first in your bootstrap.php file
                ],
            ],
        ],
],

Backend theme integration => "backend/config/main.php" file :

'components' => [ 
    'view' => [
            'theme' => [

                'pathMap' => [
                    '@backend/views' => '@themes/backend/views', // need to set // alias first in your "common/config/bootstrap.php" file
                ],
            ],
        ],
],

While coding take care of comments and directory paths and no need to write baseUrl or basePath.

like image 41
Lakhan Singh Avatar answered Sep 28 '22 18:09

Lakhan Singh