Answer the question
In order to leave comments, you need to log in
I don't understand the namespace in yii2?
My main index.php works, which binds main.php, but for some reason if I create a new page for the site and connect appAsset, then I get an error
Fatal error: Class 'frontend\assets\AppAsset' not found in C:\OpenServer\ultimat\OpenServer\domains\pergrowth\frontend\web\feedback.php on line 13
Answer the question
In order to leave comments, you need to log in
Good afternoon.
Include in the main template, that is, in views/layouts/main.php
If you include in another file, you must first specify the location of the file with the class, and then call the methods of this class.
Wrong:
Right:
use app\assets\AppAsset;
AppAsset::register($this);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question