Skip to content

rife.render.EncodeUrl

Erik C. Thauvin edited this page Mar 28, 2023 · 3 revisions

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