how I can do like this ?
public function actions() {
return [
'error' => [
'class' => 'yii\web\ErrorAction',
'layout' => '//error'
],
];
}
how I can do like this ?
public function actions() {
return [
'error' => [
'class' => 'yii\web\ErrorAction',
'layout' => '//error'
],
];
}
Create a layout file inside
views/layouts/layoutName.php
Then, inside the relative action
public function actionIndex()
{
$this->layout = 'layoutName'; // call layout
return $this->render('index', [
'model' =>$model,
]);
}
It’s not my intention, look at SiteController in yii2-app-basic or advanced, the actionError declared in actions method.
I ask, how to set a special layout (error layout) for error action only.
What kind of help do you want?
You basically asked a question with an answer in your first post.
See this Guide - Views - Named views
the way in my first post above can not be done. see my issue in github
Thanks for the link
Although you were not able to get exactly what you wanted, it looks like there are several ways.
I learned something new.