[CS2] Templating Language

Templates in Component.Studio 2 are anything inside of double braces. 

{{ }}

You can use templates anywhere you can type in text within a design or dataset except on names and quantities. Please note that template variables such as row.name are only usable in certain places. To see what is available for variables in a given field, hit the 3 dots button and look at the shortcuts.

Template Language Features

Inside of a template, you can perform basic math functions like so:

{{ 2 + 2 }}

And the output in the rendered image will of course be 4.

You could also insert a string of text

Hello {{ 'Jim' }}

Which would output Hello Jim. Note that when you have a string of text it must apear inside a pair of half quotes ('text') or quotes ("text").

You can also use variables like this:

{{ row.name }}

You might even use two or more templates and variables within the same text box to create madlibs like this:

The {{ adjective }} {{ animal }} took a bite out of {{ person }}'s apple.

And even functions like this:

{{ upperCaseFirstLetter('jim') }}

And you can combine variables and functions like this:

{{ upperCaseFirstLetter(row.name) }}

Or even get into fancy programmer stuff like ternary conditions like this:

{{ 'red' if alert == 'red' else 'black' }}

There are many operators that allow you to do fancy things. For example, if you need to concatenate 2 strings together, do this:

{{ 'Armor ' + armor }}

And if you want to get crazy there are even multiple types of template formatting:

{# do not show this #}

As you can see the templating language is very powerful. Click on a link above to explore these topics further.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us