Last active
August 14, 2016 16:50
-
-
Save kdes70/e7b1fe37da2615f0112e3333af131504 to your computer and use it in GitHub Desktop.
JS блок Yii2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$script = <<< JS | |
//some script | |
JS; | |
//маркер конца строки, обязательно сразу, без пробелов и табуляции | |
$this->registerJs($script, yii\web\View::POS_READY); | |
// POS_HEAD | |
// POS_BEGIN: после тэга <body> | |
// POS_END: перед тэгом </body> | |
// POS_LOAD: оборачивается в jQuery(window).load(). Note that by using this position, the method will automatically register the jQuery js file. | |
// POS_READY: оборачивается вjQuery(document).ready(). This is the default value. Note that by using this position, the method will automatically register the jQuery js file. | |
$this->registerJsFile('url/to/file.js', ['position' => yii\web\View::POS_END]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment