dmstr / yii2-adminlte-asset

AdminLTE Asset Bundle for Backend Theme in Yii2 Framework
1.14k stars 425 forks source link

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

Closed jolierouge closed 5 years ago

jolierouge commented 5 years ago

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

#404

Kind Regards,

githubjeka commented 5 years ago

['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() ?>
jolierouge commented 5 years ago

The result

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

Thank you!