I
I
Igor Braduloff2018-09-13 15:15:20
Yii
Igor Braduloff, 2018-09-13 15:15:20

Error when rooting in Yii2?

Good afternoon! Tell me why the error is thrown after selecting from the widget menu:
An Error occurred while handling another error:
yii\base\ViewNotFoundException: The view file does not exist: /home/igor/Projects/testmmps/frontend/views/site/error.php in /home/igor/Projects/testmmps/vendor/yiisoft/yii2/base/View.php:233
menu (views/layouts/main.php):

echo SideNav::widget([
            'options' => ['style' => 'width:200px;align:left'],
            'type' => SideNav::TYPE_SUCCESS,
            'items' => [
                [
                    'url' => '#',
                    'label' => 'Статистика',
                    'icon' => 'home'
                ],
                [
                    'label' => 'Operations',
                    'icon' => 'question-sign',
                    'items' => [
                        ['label' => 'Today', 'icon' => 'info-sign', 'url' =>Url::to(['statistic'])],


//контроллер (controllers/StatisticController.php):

namespace frontend\controllers;

use app\models\Statistic;
use yii\web\Controller;

class StatisticController extends Controller
{
    public function actionStatistic()
    {
        $modelStatistic = new Statistic();
        return $this->render('statistic',['modelStatistic' => $modelStatistic]);
    }
}

//модель (models/Statistiс.php) :
namespace app\models;
use yii\base\Model;
class Statistic extends Model
{
    public $today = "Today";
    public function rules()
    {
        return [
            ['today','required']
        ];
    }
}
//вьюшка statistic.php(путь до нее views/site)
<h1>Hello</h1>
<?php echo $modelStatistic->today;?>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2018-09-13
@webinar

when rooting

????? What is this anyway?
An Error occurred while handling another error:
yii\base\ViewNotFoundException: The view file does not exist: /home/igor/Projects/testmmps/frontend/views/site/error.php in

Yii tried to give you an error, but could not, because an error occurred while outputting an error, namely, there is no view file. Specifically this one: frontend/views/site/error.php

D
Dmitry, 2018-09-13
@slo_nik

Good afternoon.
The error says that "The view file does not exist: /home/igor/Projects/testmmps/frontend/views/site/error.php"
Check the page error setting in the configuration and the presence of the error.php file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question