Class ViewRenderer.
public __set(string $key, mixed $value): void
Parameter | Type | Description |
---|
$key | string | |
$value | mixed | |
public __isset(string $name): bool
Parameter | Type | Description |
---|
$name | string | |
public __unset(string $name): void
Parameter | Type | Description |
---|
$name | string | |
public exec(HTML $response): void
Parameter | Type | Description |
---|
$response | HTML | |
Adds a helper to the view renderer.
public addHelper(string $helper, array $args = [], ?string $alias): bool
Parameter | Type | Description |
---|
$helper | string | the name of the helper to add |
$args | array | an optional array of arguments to pass to the helper |
$alias | string | an optional alias for the helper |
Retrieves the helpers associated with the current view.
public getHelpers(): void
Removes a helper from the view renderer.
public removeHelper(string $name): void
Parameter | Type | Description |
---|
$name | string | the name of the helper to remove |
Magic method to get the value of a property.
public __get(string $key): mixed
Parameter | Type | Description |
---|
$key | string | the name of the property to get |
Populates the view renderer with data.
public populate(array $array): void
Parameter | Type | Description |
---|
$array | array | the array of data to populate the view renderer with |
Extends the data available on any defined views.
public extend(array $array): void
Parameter | Type | Description |
---|
$array | array | the array of data to extend the view renderer with |
Checks if a view exists.
public hasView(string $view): bool
Parameter | Type | Description |
---|
$view | string | the name of the view to check |
Sets the layout for the view.
public layout(string $view): void
If the current view is an instance of Layout
, it loads the specified layout. Otherwise, if the specified layout is not an instance of Layout
, it creates a new Layout
instance. Finally, it sets the view to the specified layout.
Parameter | Type | Description |
---|
$view | string | the layout or view to set |
Sets the view renderer to disable layout rendering.
public setNoLayout(): void
This method sets the view property to null, which indicates that the layout rendering should be disabled. When the layout rendering is disabled, only the view template will be rendered without any surrounding layout.
Renders a view.
public view(View $view, array $data = []): void
Parameter | Type | Description |
---|
$view | View | The view to render. It can be either a string representing the view file path or an instance of the View class. |
$data | array | The data to pass to the view |
public render(?View $view): string
Parameter | Type | Description |
---|
$view | View | |
public offsetExists(mixed $offset): bool
Parameter | Type | Description |
---|
$offset | mixed | |
public offsetGet(mixed $offset): mixed
Parameter | Type | Description |
---|
$offset | mixed | |
public offsetSet(mixed $offset, mixed $value): void
Parameter | Type | Description |
---|
$offset | mixed | |
$value | mixed | |
public offsetUnset(mixed $offset): void
Parameter | Type | Description |
---|
$offset | mixed | |
Renders a view and returns the rendered output as a string.
private renderView(View $view): string
Parameter | Type | Description |
---|
$view | View | the view object to render |
Generated by Hazaar API Doc Generator