GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I faced with strange problem. In view file i write:
$this->title = Yii::t('cabinet', 'Info');
And at first page reload i have an error:
After second reload error escapes.
If i remove "use Yii;" all will work without any error. How could it be?
use Yii; is the correct way. You may have error somewhere else
You don't need use Yii in view files.
@vova07, is it documented? how is it possible? Is the same situations in controllers?
@mitalcoi I'm not sure about documentation, but in view file you don't need to import Yii class. In controller you must import it. Just try without use Yii;.
it is undocumented. i'm got rid use Yii; and it works good. but i don't understand internal mechanism
Perhaps it's really misunderstanding.
use Yii; is to import Yii class into the current namespace. As the view file is already in the root namespace where also the Yii class lives there is not sense of importing it. Thus the error.