Below are summary of the View class design. Your feedback are welcome:
- We will still have the render() methods in controllers and widgets like we do in 1.1. However, the implementation is different. In 2.0, the render() methods in controllers/widgets will create new View objects and call their render() thereafter.
- The View class also contains methods such as widget(), beginCache() which in 1.1 are within CBaseController.
- The View class contains a property named $owner which refers to the owner of the view.
- In a view file, $this refers to the View object, while $this->owner refers to the owner of the view.
- View renderer is no longer needed in 2.0. To support a new template syntax, one needs to extend View now.
- Besides controllers and widgets, the View class can also be used in other places, such as console commands.