rife.render.EncodeBase64 - rife2/rife2-template-renderers GitHub Wiki

Encodes a template value to Base64.

Usage

<!--v render:rife.render.EncodeBase64:valueId/-->
{{v render:rife.render.EncodeBase64:valueId/}}

Sample

Template

Plain: <!--v sample/--><br>
Encoded: <!--v render:rife.render.EncodeBase64:sample/-->

Code

template.setValue("sample", "The quick brown fox jumps over the lazy dog");

Output

Plain: The quick brown fox jumps over the lazy dog<br>
Encoded: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==

Properties

By default, the rendered data is raw, not template encoded. If you need additional encoding, use the encoding property.

For example, to encode the rendered data to HTML:

{{v render:rife.render.EncodeBase64:valueId}}
encoding=html
{{/v}}

The supported additional encoding types are:

  • html
  • js
  • json
  • unicode
  • url
  • xml