@@ -35,7 +35,7 @@ class SiteController extends Controller
...
@@ -35,7 +35,7 @@ class SiteController extends Controller
```
```
As you can see, typical controller contains actions that are public class methods named as `actionSomething`.
As you can see, typical controller contains actions that are public class methods named as `actionSomething`.
The output of an action is what the method returns: it could be a string or an instance of `yii\web\Response`, [for example](#custom-response-class).
The output of an action is what the method returns: it could be a string or an instance of [[yii\web\Response]], [for example](#custom-response-class).
The return value will be handled by the `response` application
The return value will be handled by the `response` application
component which can convert the output to different formats such as JSON for example. The default behavior
component which can convert the output to different formats such as JSON for example. The default behavior
The first argument to `render()` is the name of the view to display. In the context of the controller, Yii will search for its views in `views/site/` where `site`
The first argument to `render()` is the name of the view to display. In the context of the controller, Yii will search for its views in `views/site/` where `site`
is the controller ID. For details on how the view name is resolved, refer to the [yii\base\Controller::render] method.
is the controller ID. For details on how the view name is resolved, refer to the [[yii\base\Controller::render()]] method.
The second argument to `render()` is a data array of key-value pairs. Through this array, data can be passed to the view, making the value available in the view as a variable named the same as the corresponding key.
The second argument to `render()` is a data array of key-value pairs. Through this array, data can be passed to the view, making the value available in the view as a variable named the same as the corresponding key.