ITemplateManager
in
Provides helpers for locating and rendering server-side templates.
Tags
Table of Contents
Methods
- getTemplate() : ITemplate
- Create a template for the given app and template name.
- printErrorPage() : never
- Render and print an error page, then terminate execution.
- printExceptionErrorPage() : never
- Render and print an exception error page, then terminate execution.
- printGuestPage() : void
- Render and print a guest page.
Methods
getTemplate()
Create a template for the given app and template name.
public
getTemplate(string $app, string $name[, TemplateResponse::RENDER_AS_* $renderAs = TemplateResponse::RENDER_AS_BLANK ][, bool $registerCall = true ]) : ITemplate
Parameters
- $app : string
-
App identifier that owns the template
- $name : string
-
Template name without extension
- $renderAs : TemplateResponse::RENDER_AS_* = TemplateResponse::RENDER_AS_BLANK
-
Rendering mode / layout wrapper
- $registerCall : bool = true
-
Whether to register the request for CSRF token injection
Tags
Return values
ITemplateprintErrorPage()
Render and print an error page, then terminate execution.
public
printErrorPage(string $error_msg[, string $hint = '' ][, int $statusCode = 500 ]) : never
Sets the HTTP status code before rendering. Falls back from the themed error page to an unthemed template and finally to plain-text output if rendering fails.
Parameters
- $error_msg : string
-
Error message to show
- $hint : string = ''
-
Optional hint shown with the error
- $statusCode : int = 500
-
HTTP status code to send
Tags
Return values
neverprintExceptionErrorPage()
Render and print an exception error page, then terminate execution.
public
printExceptionErrorPage(Throwable $exception[, int $statusCode = 503 ]) : never
Sets the HTTP status code before rendering. Uses the exception to populate the error view and falls back to plain-text output if rendering fails.
Parameters
- $exception : Throwable
-
Exception to render
- $statusCode : int = 503
-
HTTP status code to send
Tags
Return values
neverprintGuestPage()
Render and print a guest page.
public
printGuestPage(string $application, string $name[, array<string|int, mixed> $parameters = [] ]) : void
Assigns the provided parameters to the template before printing it. This helper does not set an HTTP status code or terminate execution.
Parameters
- $application : string
-
App identifier that owns the template
- $name : string
-
Template name without extension
- $parameters : array<string|int, mixed> = []
-
Template variables to assign