Browse Source

Merge branch 'master' of github.com:yiisoft/yii2

tags/2.0.0-alpha
Qiang Xue 11 years ago
parent
commit
ff7187e5d8
  1. 4
      docs/guide/view.md
  2. 2
      framework/yii/gii/Generator.php

4
docs/guide/view.md

@ -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

2
framework/yii/gii/Generator.php

@ -262,6 +262,7 @@ abstract class Generator extends Model
'break', 'break',
'case', 'case',
'catch', 'catch',
'callable',
'cfunction', 'cfunction',
'class', 'class',
'clone', 'clone',
@ -297,6 +298,7 @@ abstract class Generator extends Model
'include', 'include',
'include_once', 'include_once',
'instanceof', 'instanceof',
'insteadof',
'interface', 'interface',
'isset', 'isset',
'list', 'list',

Loading…
Cancel
Save