danog\MadelineProto\WebUI\TemplateEngine: Renders the native PHP templates of the web UI.
Author: Daniil Gentili daniil@daniil.it
Renders the native PHP templates of the web UI.
A template name like page or partials/field is looked up as page.phtml or partials/field.phtml
in each of the configured directories, in order, and then in the builtin template directory: a custom
directory only needs to contain the templates it overrides.
Inside a template, $this is a {@see Template}, and the variables passed to the template are in scope.
Constants
danog\MadelineProto\WebUI\TemplateEngine::BUILTIN_DIRECTORY: Directory of the builtin templates.
Method list:
__construct(list<string> $directories = [])getDirectories(): list<string>render(string $name, array<string, mixed> $data = []): stringexists(string $file): boolresolve(string $file): stringasset(string $file): string
Methods:
__construct(list<string> $directories = [])
Parameters:
$directories:list<string>Template directories, searched in order before the builtin one.
getDirectories(): list<string>
Get the template directories, in lookup order.
render(string $name, array<string, mixed> $data = []): string
Render a template.
Parameters:
$name:stringTemplate name, without the .phtml extension$data:array<string, mixed>Variables passed to the template
exists(string $file): bool
Check whether a template or asset exists.
Parameters:
$file:stringFile name relative to the template directories, including the extension
resolve(string $file): string
Get the path of a template or asset.
Parameters:
$file:stringFile name relative to the template directories, including the extension
asset(string $file): string
Get the contents of an asset (stylesheet, script, image…).
Parameters:
$file:stringFile name relative to the template directories, including the extension
Generated by danog/phpdoc