Template_Loader
An object which can load PHP templates.
Tags
Table of Contents
- get_template() : string
- Return the HTML for the specified template.
- load_template() : mixed
- Output the HTML for the specified template.
- load_template_once() : mixed
- Output the HTML for the specified template, but only once. If this function is called multiple times with the same template name, the template is only rendered once on the page.
Methods
get_template()
Return the HTML for the specified template.
public
get_template(string $template_name[, array<string|int, mixed> $args = [] ]) : string
Parameters
- $template_name : string
-
The template name (e.g. 'path/to/template.php')
- $args : array<string|int, mixed> = []
-
The template args.
Return values
string —The template HTML.
load_template()
Output the HTML for the specified template.
public
load_template(string $template_name[, array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $template_name : string
-
The template name (e.g. 'path/to/template.php')
- $args : array<string|int, mixed> = []
-
The template args.
Return values
mixed —load_template_once()
Output the HTML for the specified template, but only once. If this function is called multiple times with the same template name, the template is only rendered once on the page.
public
load_template_once(string $template_name[, array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $template_name : string
-
The template name (e.g. 'path/to/template.php')
- $args : array<string|int, mixed> = []
-
The template args.