Answer the question
In order to leave comments, you need to log in
How does Yii2 pull up views?
I did not work with Yii2, I had little experience with Laravel.
I was given a large project on Yii2 at work, I can’t understand how views are pulled up in it.
The calls go like this:
$this->render('/admin/expert/index'
$this->render('message'
$this->render('index'
$this->render('/site/cabinet/cabinet_user_info'
$this-> render('/register/remember_password_success'
Answer the question
In order to leave comments, you need to log in
There is a views folder, it contains all the views.
If just the view name is specified, then it searches in 'views/controller_name/requested_view_name.php'
If there is a slash in front, then the full path from the views folder
Accordingly, specifically according to your examples:
$this->render('/admin/expert/index'); // views/admin/expert/index.php
$this->render('message'); // views/имяКонтролера/message.php
$this->render('index'); // views/имяКонтролера/index.php
$this->render('/site/cabinet/cabinet_user_info'); // views/cabinet/cabinet_user_info.php
$this->render('/register/remember_password_success'); // views/register/remember_password_success.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question