fenom/docs/mods/escape.md

21 lines
598 B
Markdown
Raw Normal View History

2014-01-29 12:01:31 +04:00
Modifier escape
===============
2013-02-13 18:51:53 +04:00
2014-01-29 12:01:31 +04:00
The modifier escapes a string for safe insertion into the output.
It supports different escaping strategies depending on the template context.
By default, it uses the HTML escaping strategy:
2013-02-13 18:51:53 +04:00
```smarty
2014-01-29 12:01:31 +04:00
{$post.title|escape:'html'}
2013-03-15 01:12:23 +04:00
```
2014-01-29 12:01:31 +04:00
The modifier supports the following escaping strategies:
2013-03-15 01:12:23 +04:00
2014-01-29 12:01:31 +04:00
* html: escapes a string for the HTML body context.
* url: escapes a string for the URI or parameter contexts.
* js: escapes a string for the JavaScript context.
2013-03-15 01:12:23 +04:00
2014-01-29 12:01:31 +04:00
For convenience, the `e` modifier is defined as an alias of `escape` modifier.
Second parameter is charset.