The View layer of Wireframe consists of a set of interconnected components:
- The View class is a wrapper for the TemplateFile core class with some additional features. By default Wireframe makes an instance of the View class available as API variable $view, and it is through this variable that you can pass data from Controllers to layouts, views, and partial files.
- Layouts are the "frames" for your website, typically consisting of markup that remains mostly identical from page to page: header, footer, site navigation, etc. Most sites will likely only have a single layout, but it's possible to have more in case that works better for your use case. You can also change or disable a layout for a specific template or page programmatically.
- View Placeholders are used to inject content from views or Controllers to layouts. In a nutshell each View Placeholder defines a "slot" in which you can later populate content. Additionally View Placeholders can be automatically populated by having a view file that matching View Placeholder name (/views/BasicPage/header.php would populate View Placeholder called "header", etc.)
- Views (sometimes called view files) are specific to a single template, and used to render a page using that template. Each template can have more than one view – or none at all, if that page is not intended to be viewable (or if you're using some other solution to render its contents).
- Partials are reusable blocks of content that you can share between multiple templates. Shared navigation, breadcrumbs, and a search form are typical use cases for partials. As a rule of thumb if you find yourself needing same block of markup on two or more separate occasions in different layouts or views, you should probably convert it to a partial.
- Components are a newer addition that can be used to achieve many of the same goals as partials. Due to the class based architecture Components are more advanced, providing handy features for separating code from markup, accepting and processing parameters, etc.