Answer the question
In order to leave comments, you need to log in
How to connect the necessary js and css files in Yii2 modules in light?
Good afternoon!
Such a problem: there is a module in which I really want to use my layots with styles and js. How to work with them correctly? How to connect correctly?
Thanks in advance for your replies and help!
UPDATE 10/30/2014 17:50
If suddenly someone is just as stupid as I am :)
The problem lay in the fact that it was necessary to arrange the following functions according to the layout:
$this->beginPage()
$this->beginBody()
$this-> endBody()
$this->endPage(
) the template has acquired this form codepaste.ru/18221
Now everything works, but there is a problem with access, since it (CSS) is loaded from the modules folder, reading from there is prohibited, i.e. a 404 error is issued on the request, how to be here? As I understand it, in Yii, for such purposes, it is used to copy all the asset of the module to the main asset folder, which by default is lying around at the root, but how to do it right?
Answer the question
In order to leave comments, you need to log in
In your module do http://www.yiiframework.com/doc-2.0/guide-structur... and in the view of your module include
use app\yourmodule\AppAsset;
AppAsset::register($this);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question