Nextcloud PHP API (master)

ITemplateManager

Provides helpers for locating and rendering server-side templates.

Tags
since
32.0.0

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
throws
TemplateNotFoundException

if the template cannot be found

since
32.0.0
Return values
ITemplate

printErrorPage()

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
since
32.0.0
Return values
never

printExceptionErrorPage()

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
since
32.0.0
Return values
never

printGuestPage()

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

Tags
since
32.0.0
On this page

Search results