Commit 3d8b147f by Carsten Brandt

doc fix in view.md guide registerJS instead of registerScript

fixes #774
parent 9a9a9c0b
...@@ -207,12 +207,12 @@ page. We're using third argument so one of the views could override it. ...@@ -207,12 +207,12 @@ page. We're using third argument so one of the views could override it.
### Registering scripts ### Registering scripts
With View object you can register scripts. There are two dedicated methods for it: `registerScript` for inline scripts With View object you can register scripts. There are two dedicated methods for it: `registerJs` for inline scripts
and `registerJsFile` for external scripts. Inline scripts are useful for configuration and dynamically generated code. and `registerJsFile` for external scripts. Inline scripts are useful for configuration and dynamically generated code.
The method for adding these can be used as follows: The method for adding these can be used as follows:
```php ```php
$this->registerScript("var options = ".json_encode($options).";", View::POS_END, 'my-options'); $this->registerJs("var options = ".json_encode($options).";", View::POS_END, 'my-options');
``` ```
First argument is the actual code where we're converting a PHP array of options to JavaScript one. Second argument First argument is the actual code where we're converting a PHP array of options to JavaScript one. Second argument
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment