You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with `{{objectKey.attributeName}}`, e.g. `{{user.name}}`.
233
233
234
234
**Snippets** are more complex replacements that will be inserted in your template. This is useful when you need the same complex
235
-
text structure in multiple template generations, e.g. for a footer or a header text. Snippets are references in a template by
236
-
their keys only: `{{snippetKey}}`. A snippet is implemented by the interface [Snippet](https://github.com/technicalguru/php-utils/blob/main/src/TgUtils/Templating/Snippet.php).
235
+
text structure in multiple template generations, e.g. for a footer or a header text. Snippets are referenced in a template by
236
+
their keys only: `{{snippetKey}}`. A snippet is implemented by the interface [`Snippet`](https://github.com/technicalguru/php-utils/blob/main/src/TgUtils/Templating/Snippet.php).
237
237
238
238
**Formatters** can be used to format an object's attribute. Formatters can take parameters to further customize the formatting. A good example
239
239
is the [`DateFormatter`](https://github.com/technicalguru/php-utils/blob/main/src/TgUtils/Templating/DateFormatter.php). The formatter
240
240
is referenced with the object's attribute by `{{objectKey.attribute:formatterKey:param1:param2...}}`, e.g. `{{user.created_on:date:rfc822}}`.
241
241
242
-
All three elements - objects, snippets and formatters - are given to the [Processor](https://github.com/technicalguru/php-utils/blob/main/src/TgUtils/Templating/Processor.php) in its constructor:
242
+
All three elements - objects, snippets and formatters - are given to the [`Processor`](https://github.com/technicalguru/php-utils/blob/main/src/TgUtils/Templating/Processor.php) in its constructor:
243
243
244
244
```
245
245
$objects = array('user' => $myUser);
246
246
$snippets = array('header' => new HeaderSnippet(), 'footer' => $new FooterSnippet());
247
-
$formatters = array('date' => new DateFormatter();
247
+
$formatters = array('date' => new DateFormatter());
248
248
$language = 'en';
249
249
$processor = new Processor($objects, $snippets, $formatters, $language);
0 commit comments