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

URL-encodes a template value.

Usage

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

Syntax

Template

<a href="https://example.com/search?q={{v render:rife.render.EncodeUrl:query/}}"><!--v query/--></a>

Code

template.setValue("query", "books & movies");

Output

<a href="https://example.com/search?q=books%20%26%20movies">books &amp; movies</a>

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.EncodeUrl:valueId}}
encoding=html
{{/v}}

The supported additional encoding types are:

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