Answer the question
In order to leave comments, you need to log in
Default template and path depending on site login?
Good afternoon.
Please tell me how to do the following:
There are two controllers and a template:
Answer the question
In order to leave comments, you need to log in
Well, the template is not a problem:
in the controller
if(Yii::$app->user->isGuest){
$this->template = 'guest';
}else{
$this->template = 'neguest';
}
Write a behavior that will hook onto the EVENT_BEFORE_REQUEST application event and, depending on the user's authorization status, change the defaultRoute and layout settings of the application
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question