dmstr/yii2-adminlte-asset

url type error: How to prevent the Adminlte Asset layout render? i.e: http://backend.test/hfffhfhf

jolierouge opened this issue · 2 comments

url type error: How to prevent the Adminlte Asset layout render? i.e: http://backend.test/hfffhfhf

#404

Kind Regards,

['layout' => '//empty',]

 public function actionError()
    {
        $action = new \yii\web\ErrorAction($this->id, $this, ['layout' => '//empty',]);

        $exception = Yii::$app->errorHandler->exception;

        if ($exception instanceof \yii\web\BadRequestHttpException) {
            $action->view = 'errorCsrf';
        } elseif ($exception instanceof \yii\web\HttpException) {
            $action->view = 'error';
        } else {
            $action->view = 'error500';
        }

        return $action->run();
    }

empty.php

<?php

use backend\assets\AppAsset;
use backend\widgets\Alert;

/* @var $this \yii\web\View */
/* @var $content string */

$asset = AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="ru">
<?= $this->render('_head') ?>
<body>
<?php $this->beginBody() ?>
<?= Alert::widget() ?>
<?= $content ?>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>

The result

sadmac
Credits: Sad Mac 404 Error Page
A PEN BY Jon Kantner

Thank you!