M
M
McMike2018-03-20 17:25:44
Yii
McMike, 2018-03-20 17:25:44

Where does it set the layout in a basic YII2 application?

I understand Yii2, I downloaded the basic application. Views have layout main.php which is shown on all pages. Where is it asked? Neither in configs nor in controllers is there anything like layout=main

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Timofeev, 2018-03-20
@webinar

It can be overridden in many places, for example in an action:
Here are the docs on the topic: www.yiiframework.com/doc-2.0/guide-structure-views...

M
Maxim Osadchy, 2018-03-20
@waspmax1

main comes by default, you can set your own by passing $this->layout = 'yourLayout';

M
Maxim Fedorov, 2018-03-20
@qonand

main.php is the default layer used by the application if it is not set in the config or controller. Respectively set in Yii components

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question