Answer the question
In order to leave comments, you need to log in
How to include js at the end of 1C-Bitrix template?
I use Asset::getInstance()->addJs() to include scripts in the template. In footer.php file.
As far as I understand - wherever I write:
Asset::getInstance()->addJs("/local/templates/main/js/sceneIndex.js");
Parameter $additional
By default, false, that is, the scripts are connected after connecting the core scripts and the site template. If true, scripts connected by this method will be added to the end of the current script output target. Those. if they belong to the core, then after the entire core, if they belong to the template, then after the site template and they will be able to influence it.
Asset::getInstance()->addJs("/local/templates/main/js/sceneIndex.js", true);
Answer the question
In order to leave comments, you need to log in
you don't read correctly
will be added to the end of the current script output target.those. you choose after the core scripts or after the template scripts,
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question