StructrScript

Search
Feedback

StructrScript is the name of the internal scripting language that can be used in Template Expressions, Show Conditions and any of the attributes of HTML elements.

It is a simple interpreted scripting language that consists of keywords and functions. StructrScript has no control structures, it is interpreted like a fully functional language, although some of the Built-In Functions have side effects.

Examples

The following statements are typical examples for the use of StructrScript.

capitalize(page.name) Converts the first letter of the name of the current space to uppercase.
if(equal(page.name, 'index'), 'active', null) Outputs ‘active’ if the name of the current page is ‘index’, typically used in the class attribute of navigation elements to mark a link.
empty(me) Boolean expression to determine if the current request is made by an authenticated user, evaluates to false if no current user is set.
each(find('User'), print(data.name)) Outputs the name of each user in the system the current user has read access to.

Chapters

Graph-Browser

About this article
Last change 2016-03-04
Topics Structr 2.0