In Yii 1.x you could use different layouts (column1, column2 etc.), is it possible to do this in Yii 2.0 as well (in one way or another)?
When a user is logged in on my website, on all pages a sidebar needs to be displayed.
Two options i have thought of:
I can check in every view file if a user is logged in and use a partial render to render the sidebar, but that seems very inefficient.
I already created my own View class (extending the yii\web\View class). I can create a function here which will check if a user is logged in, and if so, partial render the sidebar view. But i still have to call this function in every view file then.
Yii2 is pretty good with layouts handling as well and can do what Yii 1 had but with more features. Trick is to use the aliases for paths, when you want to create a layout embedded in another layout file for example: