Answer the question
In order to leave comments, you need to log in
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
when rooting
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question