Connection a login template


I’m absolutely newbie in this framework. I’m creating a website and I need a little help.

I’m using basic Yii2 template. I downloaded login template from the internet (there are .html and .css files). I’d like to connect it to the Yii2 framework to be shown this way - when I write to the internet browser the address, this login template will be shown as first, after login of user will be shown the basic Yii2 template.

How can I do that and where should I and what to set? Where should I copy the two files of the login template?

Thank you very much for your help!

Assuming you’re using yii2 basic template

If you want to customize your login page, you should edit the login view at


Here you add all the html that you want and add your css throught


Ok, you probably understood me wrong. I need to display the html/css template ,which I downloaded, with login form firstly when somebody enter to the website. When somebody log in, I want to redirect him to the yii2 basic template. I don’t want to display the template in the yii2 basic template. I want to make the html/css template like pre-site for login and after successful login I want to display the yii2basic template.

I really don’t feel like walking you through it all, but I can give you some hints for what you need to do.

First, you need to set the layout in the login action to a new layout that is only used for the login page.

You put your login html in that.

In that layout you register the asset bundle that you have created for the login css/js.

Now you need to force login for guests.

The advanced application template forces login for all for the backend.

And setting the layout in a controller is just calling:

$this->layout = 'some_layout';


A Yii2 module for AdminLTE - can’t remember which one exactly - has a Bootstrap full page login template and asset bundle ready made, and the login action ready to go - find it on Packagist.