Template Dictionary

Placeholders

Our templates allow for you to draw on the data you put into Tiro, and present it the way you want. But with power, comes responsibility.

So to protect you from code in your templates, we keep the templates in little yellow boxes called "placeholders".

You can drag and drop placeholders around the text in your editor, you can format them like normal text, and you can add them using the "P" button on the toolbar.

Below is an overview of the things which you can put in Placeholders, to build your templates.

Variables

Variables look like this:  {{ variable }}. When the template engine encounters a variable, it evaluates that variable and replaces it with the result. Variable names consist of any combination of alphanumeric characters and the underscore ("_"). The dot (".") also appears in variable sections, although that has a special meaning, as indicated below. Importantly, you cannot have spaces or punctuation characters in variable names.

In Tiro, we provide you with a limited list of variables in which your data can be found. Here's a selection of the variables which you can use on your documents:

  • client.full_name
  • client.salutation
  • client.organisation
  • client.address_line_1
  • client.address_line_2
  • client.city
  • client.state
  • client.postcode
  • client.country_name
  • brief.matter_name
  • brief.matter.case_number
  • brief.matter.client_reference
  • brief.matter.summary
  • brief.reference_number
  • brief.hourly_rate
  • brief.daily_rate
  • brief.billable_expenses
  • brief.summary
  • user.signature
  • user.full_name
  • user.get_preferences.trading_name
  • user.chambers

Filters

You can modify variables for display by using  filters.

Filters look like this:  {{ name|lower }}. This displays the value of the {{ name }}variable after being filtered through the lower filter, which converts text to lowercase. Use a pipe (|) to apply a filter.

Filters can be “chained.” The output of one filter is applied to the next.  {{text|escape|linebreaks }} is a common idiom for escaping text contents, then converting line breaks to <p> tags.

Tags

Tags look like this:  {% tag %}. Tags are more complex than variables: Some create text in the output, some control flow by performing loops or logic, and some load external information into the template to be used by later variables.

At the moment, the only tags available to you are 'if' and 'for' tags.

If

{% if <variable> %}  Content goes here {% endif %}

Tests to see whether the variable has a value. If so, then all content up to {% endif %} will be displayed. Otherwise it will be skipped.

For

{% for <item> in <list> %}
   This item is worth ${{ item.amount }}
{% endfor %}

Example:

I estimate the following work is involved in this brief:

{% for task in brief.tasks.all %}
   - {{ task.name }}
{% endfor %}

Editing templates can certainly get tricky. If you get in to trouble, or feel like you need some assistance, then contact us at  info@tiro.com.au.

Still need help? Contact Us Contact Us