ViewBox Control - Mustache Syntax

Description

Learn how to use Mustache templating syntax in the ViewBox control as an alternative to Alpha Anywhere templating.

Overview

You can now specify that the ViewBox control should use Mustache templating syntax rather than Alpha Anywhere templating syntax. Mustache is a popular open-source templating framework.

Requirements

When you use Mustache syntax, you must use the Freeform editor as the Method for designing Layout.

In Mustache, field placeholders are enclosed in double curly braces: {{fieldname}}.

Configuring Mustache Syntax

In the Viewbox Builder, select Viewbox Properties Tab then select Viewbox Syntax and choose Mustache.

ViewBox properties showing the Mustache syntax option enabled.
Enabling Mustache Syntax

In the Viewbox Builder, select the Viewbox Layout Tab then select Freeform Editor.

Defining a template using Mustache syntax in the Freeform editor.
Mustache Template Example

Related Helper Functions

Several Xbasic functions are available for working with Mustache templates:

  • mustache_expand_template() - Expands a Mustache template by merging JSON data.
  • mustachesyntax_to_alphasyntax() - Converts a Mustache template to an Alpha Anywhere template.
  • alphasyntax_to_mustachesyntax() - Converts an Alpha Anywhere template to a Mustache template.

See Also