Skip to content

Commit

Permalink
guide WIP [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
qiangxue committed May 30, 2014
1 parent f19a97e commit 72f3a41
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion docs/guide/structure-controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ a controller ID and an action ID forms a *route* which takes the format of `Cont

End users can address any controller action through the corresponding route. For example, the URL
`http://hostname/index.php?r=site/index` specifies that the request should be handled by the `site` controller
using its `index` action.
using its `index` action. Please refer to the [Routing](runtime-routing.md) section for more details.

By default, controller and action IDs should contain lower-case alphanumeric characters and dashes only.
For example, `site`, `index`, `post-comment` and `comment2` are all valid controller/action IDs, while
Expand Down Expand Up @@ -89,6 +89,22 @@ property, like the following in an [application configuration](structure-applica
```


### Default Controller

Each application has a default controller specified via the [[yii\base\Application::defaultRoute]] property.
When a request does not specify a [route](#ids-routes), the route specified by this property will be used.
For [[yii\web\Application|Web applications]], its value is `'site'`, while for [[yii\console\Application|console applications]],
it is `help`. Therefore, if a URL is `http://hostname/index.php`, it means the `site` controller will handle the request.

You may change the default controller with the following [application configuration](structure-applications.md#application-configurations):

```php
[
'defaultRoute' => 'main',
]
```


## Creating Actions

You can create actions in two ways: inline actions and standalone actions. An inline action is
Expand Down Expand Up @@ -222,6 +238,7 @@ class SiteController extends Controller
}
```


### Action Parameters

You can define named arguments for an action and these will be automatically populated from corresponding values from
Expand Down

0 comments on commit 72f3a41

Please sign in to comment.