From 3e09adbe9732363b2d58e9e992d15abba28df4bf Mon Sep 17 00:00:00 2001 From: Qiang Xue <qiang.xue@gmail.com> Date: Fri, 2 May 2014 13:31:33 -0400 Subject: [PATCH] guide toc udpate [skip ci] --- docs/guide/README.md | 39 +++++++++++++++++++-------------------- docs/guide/start-lifecycle.md | 27 +++++++++++++++++++++++++++ docs/guide/start-structure.md | 22 ++++++++++++++++++++++ docs/guide/structure-mvc.md | 48 ------------------------------------------------ 4 files changed, 68 insertions(+), 68 deletions(-) create mode 100644 docs/guide/start-lifecycle.md create mode 100644 docs/guide/start-structure.md delete mode 100644 docs/guide/structure-mvc.md diff --git a/docs/guide/README.md b/docs/guide/README.md index fa4ad28..c44da5f 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -20,30 +20,14 @@ Getting Started * [Preparing Your Environment](start-environment.md) * [Creating Your First Yii Application](start-basic.md) -* **TBD** [Application Structure](start-structure.md) -* **TBD** [Request Lifecycle](start-lifecycle.md) +* [Application Structure](start-structure.md) +* [Request Lifecycle](start-lifecycle.md) * **TBD** [Next Steps](start-next-steps.md) -Basic Concepts --------------- - -* [Components](basic-components.md) -* [Properties](basic-properties.md) -* [Events](basic-events.md) -* [Behaviors](basic-behaviors.md) -* [Configurations](basic-configs.md) -* [Class Autoloading](basic-autoloading.md) -* [Aliases](basic-alias.md) -* **TBD** [Extensions](basic-extensions.md) -* [Service Locator](basic-service-locator.md) -* [Dependency Injection Container](basic-di-container.md) - - -Basic Structure ---------------- +Application Structure +--------------------- -* [MVC Overview](structure-mvc.md) * **TBD** [Entry Scripts](structure-entry-scripts.md) * **TBD** [Applications](structure-applications.md) * [Controllers and Actions](structure-controllers.md) @@ -65,6 +49,21 @@ Handling Requests * **TBD** [Filtering](runtime-filtering.md) +Basic Concepts +-------------- + +* [Components](basic-components.md) +* [Properties](basic-properties.md) +* [Events](basic-events.md) +* [Behaviors](basic-behaviors.md) +* [Configurations](basic-configs.md) +* [Class Autoloading](basic-autoloading.md) +* [Aliases](basic-alias.md) +* **TBD** [Extensions](basic-extensions.md) +* [Service Locator](basic-service-locator.md) +* [Dependency Injection Container](basic-di-container.md) + + Working with Databases ---------------------- diff --git a/docs/guide/start-lifecycle.md b/docs/guide/start-lifecycle.md new file mode 100644 index 0000000..c836146 --- /dev/null +++ b/docs/guide/start-lifecycle.md @@ -0,0 +1,27 @@ +Request Lifecycle +================= + +> Note: This chapter is under development. + +The following diagram shows a typical workflow of a Yii application handling a user request: + + + +1. A user makes a request of the URL `http://www.example.com/index.php?r=post/show&id=1`. + The Web server handles the request by executing the bootstrap script `index.php`. +2. The bootstrap script creates an [[yii\web\Application|Application]] instance and runs it. +3. The Application instance obtains the detailed user request information from an application component named `request`. +4. The application determines which [controller](controller.md) and which action of that controller was requested. + This is accomplished with the help of an application component named `urlManager`. + For this example, the controller is `post`, which refers to the `PostController` class, and the action is `show`, + whose actual meaning is determined by the controller. +5. The application creates an instance of the requested controller to further handle the user's request. + The controller determines that the action `show` refers to a method named `actionShow` in the controller class. + The controller then creates and executes any filters associated with this action (e.g. access control or benchmarking). + The action is then executed, if execution is allowed by the filters (e.g., if the user has permission to execute that action). +6. The action creates a `Post` [model](model.md) instance, using the underlying database table, where the ID value of the corresponding record is `1`. +7. The action renders a [view](view.md) named `show`, providing to the view the `Post` model instance. +8. The view reads the attributes of the `Post` model instance and displays the values of those attributes. +9. The view executes some [widgets](view.md#widgets). +10. The view rendering result--the output from the previous steps--is embedded within a [layout](view.md#layout) to create a complete HTML page. +11. The action completes the view rendering and displays the result to the user. diff --git a/docs/guide/start-structure.md b/docs/guide/start-structure.md new file mode 100644 index 0000000..e72864b --- /dev/null +++ b/docs/guide/start-structure.md @@ -0,0 +1,22 @@ +Application Structure +===================== + +> Note: This chapter is under development. + +Yii implements the model-view-controller (MVC) design pattern, which is +widely adopted in Web and other application programming. MVC aims to separate business logic from +user interface considerations, allowing developers to more easily change one component of an application without affecting, or even touching, another. + +In MVC, the *model* represents both the +information (the data) and the business rules to which the data must adhere. The *view* contains elements +of the user interface, such as text, images, and form elements. The *controller* manages +the communication between the model and the view, acting as an agent that handles actions and requests. + +Besides implementing the MVC design pattern, Yii also introduces a *front-controller*, called +*application*. The front-controller encapsulates the *execution context* for the processing of a request. This means that the front-controller collects information about a user request, and +then dispatches it to an appropriate controller for the actual handling of that request. In other words, the front-controller is the primary application manager, handling all requests and delegating action accordingly. + +The following diagram shows the static structure of a Yii application: + + + diff --git a/docs/guide/structure-mvc.md b/docs/guide/structure-mvc.md deleted file mode 100644 index f79808a..0000000 --- a/docs/guide/structure-mvc.md +++ /dev/null @@ -1,48 +0,0 @@ -MVC Overview -============ - -> Note: This chapter is under development. - -Yii implements the model-view-controller (MVC) design pattern, which is -widely adopted in Web and other application programming. MVC aims to separate business logic from -user interface considerations, allowing developers to more easily change one component of an application without affecting, or even touching, another. - -In MVC, the *model* represents both the -information (the data) and the business rules to which the data must adhere. The *view* contains elements -of the user interface, such as text, images, and form elements. The *controller* manages -the communication between the model and the view, acting as an agent that handles actions and requests. - -Besides implementing the MVC design pattern, Yii also introduces a *front-controller*, called -*application*. The front-controller encapsulates the *execution context* for the processing of a request. This means that the front-controller collects information about a user request, and -then dispatches it to an appropriate controller for the actual handling of that request. In other words, the front-controller is the primary application manager, handling all requests and delegating action accordingly. - -The following diagram shows the static structure of a Yii application: - - - - -A Typical Workflow ------------------- - -The following diagram shows a typical workflow of a Yii application handling a user request: - - - -1. A user makes a request of the URL `http://www.example.com/index.php?r=post/show&id=1`. - The Web server handles the request by executing the bootstrap script `index.php`. -2. The bootstrap script creates an [[yii\web\Application|Application]] instance and runs it. -3. The Application instance obtains the detailed user request information from an application component named `request`. -4. The application determines which [controller](controller.md) and which action of that controller was requested. - This is accomplished with the help of an application component named `urlManager`. - For this example, the controller is `post`, which refers to the `PostController` class, and the action is `show`, - whose actual meaning is determined by the controller. -5. The application creates an instance of the requested controller to further handle the user's request. - The controller determines that the action `show` refers to a method named `actionShow` in the controller class. - The controller then creates and executes any filters associated with this action (e.g. access control or benchmarking). - The action is then executed, if execution is allowed by the filters (e.g., if the user has permission to execute that action). -6. The action creates a `Post` [model](model.md) instance, using the underlying database table, where the ID value of the corresponding record is `1`. -7. The action renders a [view](view.md) named `show`, providing to the view the `Post` model instance. -8. The view reads the attributes of the `Post` model instance and displays the values of those attributes. -9. The view executes some [widgets](view.md#widgets). -10. The view rendering result--the output from the previous steps--is embedded within a [layout](view.md#layout) to create a complete HTML page. -11. The action completes the view rendering and displays the result to the user. -- libgit2 0.27.1