Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I customize yii2 theme

Tags:

yii

yii2

Im just trying Yii2. Now I have created a yii2 basic appication. Next what I want to do is change the theme. I have an HTML file I want to change this appications theme as like that HTML. I have gone through yii2 theming But Its not what i want I want to add all css,js,images,font of that HTML to my project. How can I do this in yii2 Plz somebody help me.

like image 371
Salini L Avatar asked Aug 05 '14 07:08

Salini L


1 Answers

Hi you have to do following things for theming in yii2 as simple as yii1 :-

  1. first of all open web.php into config directory of yii2 application,
  2. then in component array pass view array like:

        'view' => [
                  'theme' => [
                     'pathMap' => [ 
                        '@app/views' => [ 
                            '@webroot/themes/demo/views',
    
                         ]
                     ],
                   ],
                ] // here demo is your folder name
    

now create the folder name as "themes" into web directory.

In this themes folder copy your html folder like(demo) which contains all css, js etc. files. in this folder create views folder as yii which contains main.php and others layouts if needed.

override index.php in views by your corresponding index file by appropriate changes into paths of files. create corresponding views and actions for your html files. in yii2 we can define our css and js into Appasset.php .

like image 140
sprytechies Avatar answered Oct 08 '22 13:10

sprytechies