View (class)

Class View

View, the V in the MVC triad. View interacts with Helpers and view variables passed in from the controller to render the results of the controller action. Often this is HTML, but can also take the form of JSON, XML, PDF's or streaming files.

CakePHP uses a two-step-view pattern. This means that the view content is rendered first, and then inserted into the selected layout. This also means you can pass data from the view to the layout using $this->set()

Since 2.1, the base View class also includes support for themes by default. Theme views are regular view files that can provide unique HTML and static assets. If theme views are not found for the current view the default app view files will be used. You can set $this->theme = 'mytheme' in your Controller to use the Themes.

Example of theme path with $this->theme = 'SuperHot'; Would be app/View/Themed/SuperHot/Posts