Skip to main content
A Template Variable puts a dynamic value into Fluid (filters, sorting, page IDs, GET params, …). Select it later in the plugin under Variable Injection. Template variables keep logic out of your templates. Instead of reading the URL or the logged-in user inside Fluid, you define once where a value comes from, give it a name, and every plugin that injects the variable can use it — in the template as {yourVariableName}, and in plugin settings that accept Fluid, such as filter conditions. The value is resolved fresh on every request when the plugin renders. New Template Variable

Create one

  1. Storage folder → Create new → Template Variable
  2. Set Template Variable Name (Fluid name)
  3. Pick Type (where the value comes from)
  4. Save · enable it on the plugin
The names record, records, part, cObj and settings are reserved by the plugins and cannot be used.

Types (overview)

After you choose a Type, the form shows only the settings that type needs.

GET / POST extras

Values from the request come from the visitor and cannot be trusted. Tonictypes cleans each value, and these options let you restrict it further:
  • Type Definition · Regular Expression · Allowed Values
    • Type Definition — cast the value to Boolean, Integer, Float or String, so ?limit=abc becomes a number
    • Regular Expression — the value is dropped unless it matches the pattern
    • Allowed Values — the value is dropped unless it is in the list
  • Value Switch tab — change the resolved value with Fluid when a condition matches (first match wins)
Each Value Switch entry has a Condition and a Fluid Input; both can use the parameter as a Fluid variable. The entries are checked from top to bottom and the first matching condition returns its rendered Fluid. The switch also runs when the parameter is missing, so you can use it to set a default. If a variable has Value Switch entries, they replace the Regular Expression and Allowed Values checks, so put your validation into the conditions. Value Switch tab with switch entries Value Switch — e.g. reverse a sort-order GET parameter Example condition: {sortOrder} == 'asc' → Fluid that returns desc (and the reverse).

Example: sort order from the URL

  1. Create a Template Variable, name sortOrder, type GET Variable, Parameter Name order, and add the two entries asc and desc under Allowed Values.
  2. On the Record List plugin, select it under Variable Injection.
  3. In the template, {sortOrder} now holds asc or desc from ?order=…; any other value is dropped. To let such variables drive the query’s sorting directly, use the plugin’s Overrides sheet — see Plugin configuration.

Next

Templating