Layout
Layout
Properties
content
private string $content
renderedViews
public string $renderedViews
views
private array $views
Methods
__construct
public __construct({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$view | string |
setContent
Sets the content of the layout.
public setContent({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$content | string | the content to set |
prepare
Prepares the layout for rendering.
public prepare({Array})
This method prepares the layout by rendering all the views added to it. It adds the layout's helpers to each view, extends the view's data with the layout's data, and renders each view. If the $merge_data
parameter is set to true, it also extends the layout's data with each view's data.
Parameters
Parameter | Type | Description |
---|---|---|
$merge_data | bool | Whether to merge the layout's data with each view's data. Default is true. |
render
Renders the layout and returns it as a string.
public render({Array})
If the 'prepare' flag is set to true in the view configuration, the layout will be prepared before rendering.
Parameters
Parameter | Type | Description |
---|---|---|
$data | array | the data to render the layout with |
layout
Returns the layout content.
public layout({Array})
This method prepares the views and merges the data back in, if necessary. The layout content is then returned as a string.
add
Add a view to the layout.
public add({Array})
This method will add a view based on the supplied argument. If the argument is a string a new Hazaar\View object is created using the view file named in the argument. Alterntively, the argument can be a Hazaar\View object which will simply then be added to the layout.
Parameters
Parameter | Type | Description |
---|---|---|
$view | View | A string naming the view to load, or an existing Hazaar_View object |
$key | string | Optional key to store the view as. Allows direct referencing later. |
remove
Removes a view from the layout.
public remove({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$key | string | the key of the view to remove |
Generated by Hazaar API Doc Generator