danog\MadelineProto\WebUI\Template: A template being rendered: `$this` inside a .phtml template.
Author: Daniil Gentili daniil@daniil.it
A template being rendered: $this inside a .phtml template.
Templates can extend a layout and fill its sections:
<?php $this->layout('layout', ['title' => $page->title]) ?>
<?php $this->start('head') ?><style>...</style><?php $this->stop() ?>
<p>The rest of the output becomes the "content" section of the layout.</p>
Use {@see self::e()} to output any value: strings are escaped, {@see SafeHtml} is output as-is.
Method list:
getEngine(): \danog\MadelineProto\WebUI\TemplateEnginelayout(string $name, array<string, mixed> $data = []): voidstart(string $name): voidstop(): voidsection(string $name, string $default = ''): \danog\MadelineProto\WebUI\SafeHtmlhasSection(string $name): boolinsert(string $name, array<string, mixed> $data = []): \danog\MadelineProto\WebUI\SafeHtmlasset(string $file): \danog\MadelineProto\WebUI\SafeHtmlscript(string $file): \danog\MadelineProto\WebUI\SafeHtmlescapeScript(string $script): stringe(mixed $value): stringattrs(array<string, (scalar|\Stringable|null)> $attributes): \danog\MadelineProto\WebUI\SafeHtmlt(string $key, (string|int|float) ...$args): stringtHtml(string $key, (string|int|float) ...$args): \danog\MadelineProto\WebUI\SafeHtmltranslate(string $key, (string|int|float) ...$args): string
Methods:
getEngine(): \danog\MadelineProto\WebUI\TemplateEngine
Get the template engine.
See also:
layout(string $name, array<string, mixed> $data = []): void
Extend a layout: the output of this template becomes its content section.
Parameters:
$name:string$data:array<string, mixed>Additional variables for the layout
start(string $name): void
Start capturing a section.
Parameters:
$name:string
stop(): void
Stop capturing the current section.
section(string $name, string $default = ''): \danog\MadelineProto\WebUI\SafeHtml
Output a section.
Parameters:
$name:string$default:stringDefault HTML if the section was not filled
See also:
hasSection(string $name): bool
Check whether a section was filled.
Parameters:
$name:string
insert(string $name, array<string, mixed> $data = []): \danog\MadelineProto\WebUI\SafeHtml
Render another template (partial) in place.
Parameters:
$name:string$data:array<string, mixed>Variables passed to the template
See also:
asset(string $file): \danog\MadelineProto\WebUI\SafeHtml
Get the contents of an asset, to inline it in a <style> or <script> tag.
Parameters:
$file:string
See also:
script(string $file): \danog\MadelineProto\WebUI\SafeHtml
Get the contents of a script asset, to inline it in a <script> tag.
A </script in the script (in a string literal, or in a comment) would close the tag early, and a<!-- followed by <script would keep the real </script> from closing it: they’re escaped to<\/script and <\!--, which mean the same in JavaScript strings and comments.
Parameters:
$file:string
See also:
escapeScript(string $script): string
Escape a script to inline it in a <script> tag, see {@see self::script()}.
Parameters:
$script:string
e(mixed $value): string
Escape a value for output in HTML text or in a quoted attribute.
Parameters:
$value:mixed
attrs(array<string, (scalar|\Stringable|null)> $attributes): \danog\MadelineProto\WebUI\SafeHtml
Build an HTML attribute list: true outputs just the name, null and false skip the attribute.
Parameters:
$attributes:array<string, (scalar|\Stringable|null)>
See also:
scalar\Stringable\danog\MadelineProto\WebUI\SafeHtml: A trusted HTML fragment, output as-is by templates instead of being escaped.
t(string $key, (string|int|float) ...$args): string
Translate a string, escaping it.
Parameters:
$key:string...$args:(string|int|float)sprintf arguments
tHtml(string $key, (string|int|float) ...$args): \danog\MadelineProto\WebUI\SafeHtml
Translate a string that contains trusted HTML (like links), escaping only the arguments.
Parameters:
$key:string...$args:(string|int|float)sprintf arguments
See also:
translate(string $key, (string|int|float) ...$args): string
Translate a string.
Parameters:
$key:string...$args:(string|int|float)sprintf arguments
Generated by danog/phpdoc